@@ -120,20 +120,18 @@ def github_app_install_url(self):
120120 return f"{ settings .GITHUB_APP_INSTALL_URL } ?state={ self .github_state } "
121121
122122 @cached_property
123- def github_request_kwargs (self ):
123+ def github_request_headers (self ):
124124 return {
125- "headers" : {
126- "Accept" : "application/vnd.github+json" ,
127- "Authorization" : f"token { self .github_user_token .access_token } " ,
128- },
129- "timeout" : 10 ,
125+ "Accept" : "application/vnd.github+json" ,
126+ "Authorization" : f"token { self .github_user_token .access_token } " ,
130127 }
131128
132129 @cached_property
133130 def installations (self ):
134- response = requests .get (
131+ response = httpx .get (
135132 "https://api.github.com/user/installations" ,
136- ** self .github_request_kwargs ,
133+ headers = self .github_request_headers ,
134+ timeout = 10 ,
137135 )
138136 response .raise_for_status ()
139137 return response .json ()["installations" ]
@@ -176,11 +174,11 @@ async def _get_page_github_repos(
176174 response = await httpx_client .get (
177175 f"https://api.github.com/user/installations/{ installation_id } /repositories" ,
178176 params = {"per_page" : per_page , "page" : page },
179- ** self .github_request_kwargs ,
177+ headers = self .github_request_headers ,
180178 )
181179 response .raise_for_status ()
182180
183- return await response .json ()
181+ return response .json ()
184182
185183 async def _get_installation_github_repos (
186184 self , * , installation_id , semaphore , httpx_client
@@ -226,10 +224,12 @@ async def _get_installation_github_repos(
226224 response = task .result ()
227225 repos += [repo ["full_name" ] for repo in response ["repositories" ]]
228226
227+ return repos
228+
229229 @async_to_sync
230230 async def _get_all_github_repos (self ):
231231 semaphore = asyncio .Semaphore (ASYNC_CONCURRENCY )
232- timeout = httpx .Timeout (self . github_request_kwargs [ "timeout" ] )
232+ timeout = httpx .Timeout (10 )
233233
234234 tasks = []
235235
0 commit comments