@@ -19,7 +19,9 @@ class AsyncLpdbSession(AbstractLpdbSession):
1919
2020 def __init__ (self , api_key ):
2121 super ().__init__ (api_key )
22- self .__session = aiohttp .ClientSession (AbstractLpdbSession .BASE_URL )
22+ self .__session = aiohttp .ClientSession (
23+ AbstractLpdbSession .BASE_URL , headers = self ._get_header ()
24+ )
2325
2426 def __enter__ (self ) -> None :
2527 raise TypeError ("Use async with instead" )
@@ -83,7 +85,6 @@ async def make_request(
8385 raise ValueError (f'Invalid LPDB data type: "{ lpdb_datatype } "' )
8486 async with self .__session .get (
8587 lpdb_datatype ,
86- headers = self ._get_header (),
8788 params = AbstractLpdbSession ._parse_params (
8889 wiki = wiki ,
8990 limit = limit ,
@@ -119,9 +120,7 @@ async def get_team_template(
119120 }
120121 if date != None :
121122 params ["date" ] = date .isoformat ()
122- async with self .__session .get (
123- "teamtemplate" , headers = self ._get_header (), params = params
124- ) as response :
123+ async with self .__session .get ("teamtemplate" , params = params ) as response :
125124 parsed_response = await AsyncLpdbSession .__handle_response (response )
126125 if parsed_response [0 ] == None :
127126 return None
@@ -133,7 +132,6 @@ async def get_team_template_list(
133132 ) -> list [dict [str , Any ]]:
134133 async with self .__session .get (
135134 "teamtemplatelist" ,
136- headers = self ._get_header (),
137135 params = {"wiki" : wiki , "pagination" : pagination },
138136 ) as response :
139137 return await AsyncLpdbSession .__handle_response (response )
0 commit comments