def test_job_contains_item(): from api.scrapers.character import scrape_character from api.constants import JOBS mina = scrape_character('8774791') whm = mina.jobs.filter_by(job=JOBS.WHITEMAGE).first() circlet = next(filter(lambda i: i.name == 'Platinum Circlet of Healing', whm.items)) assert circlet.defense == 38
def scrape_free_company_members(fc, total_members): page_num = 1 while total_members > 0: total_members -= 50 page_num += 1 url = 'http://na.finalfantasyxiv.com/lodestone/freecompany/{lodestone_id}/member/?page={page_num}'.format( lodestone_id=fc.id, page_num=page_num) with HTMLFromLoadstone(url) as html: character_ids = map(lambda x: x.attrib['href'].split('/')[3], html.xpath('//div[@class="name_box"]/a')) for character_id in character_ids: fc.members_id.append( scrape_character(character_id, skip_free_company_parse=True))
def scrape_free_company_members(fc, total_members): page_num = 1 while total_members > 0: total_members -= 50 page_num += 1 url = 'http://na.finalfantasyxiv.com/lodestone/freecompany/{lodestone_id}/member/?page={page_num}'.format( lodestone_id=fc.id, page_num=page_num) with HTMLFromLoadstone(url) as html: character_ids = map( lambda x: x.attrib['href'].split('/')[3], html.xpath('//div[@class="name_box"]/a')) for character_id in character_ids: fc.members_id.append(scrape_character(character_id, skip_free_company_parse=True))
def mina(app): from api.scrapers.character import scrape_character return scrape_character('8774791')
def get_character(lodestone_id): if not re.match(r'^[0-9]+$', lodestone_id): raise InvalidRequest('Illegal characters in requested ID') return scrape_character(lodestone_id)