Created
October 24, 2020 17:36
-
-
Save fcschmidt/00d6137e85a25407a7d079a60a74703b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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