File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 3535 "{description}\n "
3636)
3737
38+ WIKI_HEADERS = {
39+ "User-Agent" :
"SirLancebot/0.0 (https://github.com/python-discord; [email protected] ) aiohttp/0.0" 40+ }
41+
3842
3943class WikipediaSearch (commands .Cog ):
4044 """Get info from wikipedia."""
@@ -45,7 +49,7 @@ def __init__(self, bot: Bot):
4549 async def wiki_request (self , channel : TextChannel , search : str ) -> list [str ]:
4650 """Search wikipedia search string and return formatted first 10 pages found."""
4751 params = WIKI_PARAMS | {"srlimit" : 10 , "srsearch" : search }
48- async with self .bot .http_session .get (url = SEARCH_API , params = params ) as resp :
52+ async with self .bot .http_session .get (url = SEARCH_API , params = params , headers = WIKI_HEADERS ) as resp :
4953 if resp .status != 200 :
5054 log .info (f"Unexpected response `{ resp .status } ` while searching wikipedia for `{ search } `" )
5155 raise APIError ("Wikipedia API" , resp .status )
You can’t perform that action at this time.
0 commit comments