Skip to content

Instantly share code, notes, and snippets.

@fcschmidt
Created October 24, 2020 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fcschmidt/00d6137e85a25407a7d079a60a74703b to your computer and use it in GitHub Desktop.
Save fcschmidt/00d6137e85a25407a7d079a60a74703b to your computer and use it in GitHub Desktop.
# import asyncio
# import aiohttp
# from app.spiders.models import RestockQueryset
# from bs4 import BeautifulSoup
#
#
# async def fetch(session, url):
# async with session.get(url) as response:
# result = await response.text()
# soup = BeautifulSoup(result, "html.parser")
# print(soup.title)
# return result
#
#
# async def client_session(urls):
# async with aiohttp.ClientSession() as session:
# tasks = []
# for url in urls:
# tasks.append(
# fetch(session=session, url=url)
# )
# await asyncio.gather(*tasks)
#
#
# def main():
# url_list = [item["snkrsUrl"] for item in RestockQueryset("nike_restock").get_all_snkrs()]
# loop = asyncio.get_event_loop()
# loop.run_until_complete(client_session(urls=url_list))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment