chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import logging
|
||||
import sys
|
||||
|
||||
# Import asyncio timeout depends on python version
|
||||
if sys.version_info >= (3, 11):
|
||||
from asyncio import timeout as asyncio_timeout
|
||||
else:
|
||||
from async_timeout import timeout as asyncio_timeout
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def http_get(http_session, url, timeout_seconds=60):
|
||||
async with asyncio_timeout(timeout_seconds):
|
||||
async with http_session.get(url) as response:
|
||||
return await response.json()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
Reference in New Issue
Block a user