File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -136,13 +136,15 @@ class RequestsDispatcher(object):
136
136
def __init__ (self , workers = 4 ):
137
137
# general session for sync api calls
138
138
self .session = RedirectSession ()
139
- self .session .headers .update ({'User-Agent' : _get_user_agent ()})
139
+ self .session .headers .update ({
140
+ 'User-Agent' : _get_user_agent (),
141
+ 'X-Planet-App' : 'python-client'
142
+ })
140
143
# ensure all calls to the session are throttled
141
144
self .session .request = _Throttler ().wrap (self .session .request )
142
145
# the asyncpool is reserved for long-running async tasks
143
- self ._asyncpool = FuturesSession (
144
- max_workers = workers ,
145
- session = self .session )
146
+ self ._asyncpool = FuturesSession (max_workers = workers ,
147
+ session = self .session )
146
148
147
149
def response (self , request ):
148
150
return Response (request , self )
Original file line number Diff line number Diff line change 95
95
96
96
def _get_json_or_raise (url , timeout = 11 ):
97
97
api_key = find_api_key ()
98
- headers = {'User-Agent' : _get_user_agent (),
99
- 'Authorization' : 'api-key %s' % api_key }
98
+ headers = {
99
+ 'User-Agent' : _get_user_agent (),
100
+ 'X-Planet-App' : 'python-client' ,
101
+ 'Authorization' : 'api-key %s' % api_key
102
+ }
100
103
resp = requests .get (url , timeout = timeout , headers = headers )
101
104
resp .raise_for_status ()
102
105
return resp .json ()
You can’t perform that action at this time.
0 commit comments