plutopluto

git clone https://git.ce9e.org/plutopluto.git

commit
ade891e611cf65a96edc1576f88ea69527269b4c
parent
3c076c52613cb61fef200b04e25e4cef379f40ce
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-12-21 13:53
set user-agent

Diffstat

M plutopluto/__init__.py 8 ++++++--

1 files changed, 6 insertions, 2 deletions


diff --git a/plutopluto/__init__.py b/plutopluto/__init__.py

@@ -23,9 +23,13 @@ BASE_DIR = Path(__file__).parent
   23    23 URLS = []
   24    24 
   25    25 
   26    -1 async def fetch(url, *, raw=False, **kwargs):
   -1    26 async def fetch(url, *, headers={}, raw=False, **kwargs):
   27    27     async with aiohttp.ClientSession() as session:
   28    -1         async with session.get(url, **kwargs) as response:
   -1    28         async with session.get(
   -1    29             url,
   -1    30             headers={'User-agent': 'plutopluto', **headers},
   -1    31             **kwargs,
   -1    32         ) as response:
   29    33             if response.status == 404:
   30    34                 raise web.HTTPNotFound
   31    35             elif response.status == 403: