ip limit fix
This commit is contained in:
parent
eaf3480341
commit
5a6963b371
17
ebay_api.py
17
ebay_api.py
@ -227,19 +227,20 @@ class ShoppingApi:
|
||||
|
||||
try:
|
||||
# random sleep here between 0 and 10 secs?
|
||||
|
||||
sleep(randint(1,10))
|
||||
response = requests.get(url, headers=headers,timeout=24)
|
||||
response.raise_for_status()
|
||||
print('index number {}'.format(item_id_results.index(twenty_id)))
|
||||
response = response.json()
|
||||
response = response['Item']
|
||||
|
||||
except requests.exceptions.RequestException: # TODO need better handling
|
||||
print('connection error')
|
||||
|
||||
except (requests.exceptions.RequestException, KeyError): # TODO need better handling
|
||||
print('connection error. IP limit possibly exceeded')
|
||||
print('index number {}'.format(item_id_results.index(twenty_id)))
|
||||
return
|
||||
|
||||
response = response.json()
|
||||
response = response['Item']
|
||||
|
||||
return response
|
||||
|
||||
def conky(self):
|
||||
@ -276,17 +277,11 @@ class ShoppingApi:
|
||||
|
||||
# NOTE:
|
||||
|
||||
# UPDATE** 76 pages seems like it might be too much.
|
||||
# Limited to 5000 calls to shopping api per day, and getMultpileitems service maxes out at 20 items
|
||||
# per call leaving you 100,000 items per day for you pandas dataframe initially. So you'll have
|
||||
# to divide these up into the categories. This will leave you with about 6.25K results per cat.
|
||||
# More than enough data for your dataset.
|
||||
|
||||
#class SDKTrading:
|
||||
# api = Trading(config_file='ebay.yaml')
|
||||
# response = api.execute('GetUser', {})
|
||||
# print(response.dict())
|
||||
# print(response.reply)
|
||||
|
||||
class CurateData:
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user