File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919from requests .adapters import HTTPAdapter
2020from urllib3 .util .retry import Retry
2121
22- # First-party/Local
23- import shared # noqa: E402
24- from shared import STATUS_FORCELIST , USER_AGENT
25-
2622# Add parent directory so shared can be imported
2723sys .path .append (os .path .join (os .path .dirname (__file__ ), ".." ))
2824
25+ # First-party/Local
26+ import shared # noqa: E402
27+
2928# Setup
3029LOGGER , PATHS = shared .setup (__file__ )
3130FILE_LANGUAGES = os .path .join (
@@ -63,11 +62,11 @@ def get_requests_session():
6362 max_retries = Retry (
6463 total = 5 ,
6564 backoff_factor = 10 ,
66- status_forcelist = STATUS_FORCELIST ,
65+ status_forcelist = shared . STATUS_FORCELIST ,
6766 )
6867 session = requests .Session ()
6968 session .mount ("https://" , HTTPAdapter (max_retries = max_retries ))
70- session .headers .update ({"User-Agent" : USER_AGENT })
69+ session .headers .update ({"User-Agent" : shared . USER_AGENT })
7170 return session
7271
7372
Original file line number Diff line number Diff line change 77from git import InvalidGitRepositoryError , NoSuchPathError , Repo
88from pandas import PeriodIndex
99
10- USER_AGENT = (
11- "QuantifyingTheCommons/1.0 "
12- "(https://github.com/creativecommons/quantifying)"
13- )
1410STATUS_FORCELIST = [
1511 408 , # Request Timeout
1612 422 , # Unprocessable Content (Validation failed, or endpoint spammed)
2117 504 , # Gateway Timeout
2218]
2319
20+ USER_AGENT = (
21+ "QuantifyingTheCommons/1.0 "
22+ "(https://github.com/creativecommons/quantifying)"
23+ )
24+
2425
2526class QuantifyingException (Exception ):
2627 def __init__ (self , message , exit_code = None ):
You can’t perform that action at this time.
0 commit comments