File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 3232# Constants
3333FILE1_COUNT = os .path .join (PATHS ["data_phase" ], "github_1_count.csv" )
3434GH_TOKEN = os .getenv ("GH_TOKEN" )
35- GITHUB_RETRY_STATUS_FORCELIST = [
36- 408 , # Request Timeout
37- 422 , # Unprocessable Content (Validation failed, or endpoint spammed)
38- 429 , # Too Many Requests
39- 500 , # Internal Server Error
40- 502 , # Bad Gateway
41- 503 , # Service Unavailable
42- 504 , # Gateway Timeout
43- ]
4435# Also see: https://en.wikipedia.org/wiki/Public-domain-equivalent_license
4536GITHUB_TOOLS = [
4637 {"TOOL_IDENTIFIER" : "BSD Zero Clause License" , "SPDX_IDENTIFIER" : "0BSD" },
@@ -93,11 +84,14 @@ def get_requests_session():
9384 max_retries = Retry (
9485 total = 5 ,
9586 backoff_factor = 10 ,
96- status_forcelist = GITHUB_RETRY_STATUS_FORCELIST ,
87+ status_forcelist = shared . STATUS_FORCELIST ,
9788 )
9889 session = requests .Session ()
9990 session .mount ("https://" , HTTPAdapter (max_retries = max_retries ))
100- headers = {"accept" : "application/vnd.github+json" }
91+ headers = {
92+ "accept" : "application/vnd.github+json" ,
93+ "User-Agent" : shared .USER_AGENT ,
94+ }
10195 if GH_TOKEN :
10296 headers ["authorization" ] = f"Bearer { GH_TOKEN } "
10397 session .headers .update (headers )
You can’t perform that action at this time.
0 commit comments