def singleRun(gamertag,platform): '''Single run of Webscrape.retrieveDataRLTracker''' logger.info("Start for gamertag:%(gamertag)s"% locals()) scrape = Webscrape() data = scrape.retrieveDataRLTracker(gamertag=gamertag,platform=platform) if data is not None: pprint(data) logger.info("Finish for gamertag:%(gamertag)s"% locals())
async def singleRun(): logger.info("Start for csv input:%s" % (results.input)) inputoutput = csvIO() # initialize class pdict = inputoutput.areadCSVLinks() # read the csv file tasks = [] for k,v in pdict.items(): task = loop.create_task(inputoutput._safe_download(k,v)) # start the retrieve process tasks.append(task) responses = [] for task in pbar(asyncio.as_completed(tasks),desc='retrieve',total=len(tasks)): responses.append(await task) await inputoutput.awriteCSV(responses) logger.info("Finish for csv output:%s" % (results.output))
def _parsePlaylist(self,data=None): ''' Using the json data to assign values to the proper fields ''' a = {} playlist = data['metadata']['name'] a[playlist] = {"Tier Rank": None, "Tier Number": None, "Tier Division": None, "Games Played": None, "MMR": None} try: a[playlist]["Tier Rank"] = data['stats']['tier']['metadata']['name'] a[playlist]["Tier Number"] = data['stats']['tier']['value'] a[playlist]["Tier Divisio"] = data['stats']['division']['metadata']['name'] a[playlist]["Games Played"] = data['stats']['matchesPlayed']['value'] a[playlist]["MMR"] = data['stats']['rating']['value'] except Exception as e: logger.info("Could not find %(playlist)s data with error: " % locals(),e) return a
def singleRun(): logger.info("Start for csv input:%s" % (results.input)) csvIO().readCSVLinks() logger.info("Finish for csv output:%s" % (results.output))
def checkFolders(): if not os.path.exists("Scrapes"): logger.info("Creating Scrapes folder...") os.makedirs("Scrapes")