I am trying to connect ebay with python script. here is my code, I have used ebaysdk-python
import ebaysdk
from ebaysdk.finding import Connection as finding
from ebaysdk.exception import ConnectionError
try:
api = finding(debug=True, config_file='myebay.yaml',)
api_request = {
'Keywords':'Harry Potter',
'MaxEntries': 2,
'AvailableItemsOnly':True,
}
response = api.execute('findItemsAdvanced', api_request)
print response
except ConnectionError as e:
print "\n\n\n",e
print "\n\n\n",e.response.dict()
while running this I am getting below error. Here is the debug result
2015-08-25 12:24:18,101 ebaysdk [DEBUG]:execute: verb=findItemsAdvanced data={'Keywords': 'Harry Potter', 'MaxEntries': 2, 'AvailableItemsOnly': True}
2015-08-25 12:24:18,107 ebaysdk [DEBUG]:REQUEST (cb3019a4-1f9a-4e82-9ba9-b45ed84329dd): POST http://svcs.ebay.com/services/search/FindingService/v1
2015-08-25 12:24:18,107 ebaysdk [DEBUG]:headers=CaseInsensitiveDict({'X-EBAY-SOA-GLOBAL-ID': 'EBAY-US', 'Content-Length': '254', 'X-EBAY-SOA-SECURITY-APPNAME': u'test-08c4-473a-8461-415f8024798f', 'X-EBAY-SOA-OPERATION-NAME': 'findItemsAdvanced', 'X-EBAY-SOA-SERVICE-NAME': 'FindingService', 'X-EBAY-SOA-SERVICE-VERSION': u'1.0.0', 'User-Agent': 'eBaySDK/2.1.2 Python/2.7.6 Linux/3.16.0-46-generic', 'X-EBAY-SDK-REQUEST-ID': 'cb3019a4-1f9a-4e82-9ba9-b45ed84329dd', 'X-EBAY-SOA-RESPONSE-DATA-FORMAT': 'XML', 'X-EBAY-SOA-REQUEST-DATA-FORMAT': 'XML', 'Content-Type': 'text/xml'})
2015-08-25 12:24:18,107 ebaysdk [DEBUG]:body=<?xml version='1.0' encoding='utf-8'?><findItemsAdvancedRequest xmlns="http://www.ebay.com/marketplace/search/v1/services"><AvailableItemsOnly>True</AvailableItemsOnly><Keywords>Harry Potter</Keywords><MaxEntries>2</MaxEntries></findItemsAdvancedRequest>
2015-08-25 12:24:18,809 ebaysdk [DEBUG]:RESPONSE (cb3019a4-1f9a-4e82-9ba9-b45ed84329dd):
2015-08-25 12:24:18,809 ebaysdk [DEBUG]:elapsed time=0:00:00.701135
2015-08-25 12:24:18,809 ebaysdk [DEBUG]:status code=500
2015-08-25 12:24:18,809 ebaysdk [DEBUG]:headers=CaseInsensitiveDict({'x-ebay-soa-global-id': 'EBAY-US', 'x-ebay-request-id': '14f63a2c-ffb0-a7ea-3304-9134ce2175ca!services.search.FindingService.v1!10.126.163.48!fndngesb[]', 'x-cnection': 'close', 'x-ebay-soa-operation-name': 'findItemsAdvanced', 'transfer-encoding': 'chunked', 'x-ebay-soa-error-response': 'TRUE', 'x-ebay-soa-service-name': '{http://www.ebay.com/marketplace/search/v1/services}FindingService', 'x-ebay-soa-service-version': '1.13.0', 'server': 'Apache-Coyote/1.1', 'x-ebay-soa-locale-list': 'en-US_US', 'x-ebay-soa-message-protocol': 'NONE', 'date': 'Tue, 25 Aug 2015 06:54:17 GMT', 'x-ebay-soa-request-id': '14f63a2d-0360-a7ed-d744-9224fd474628!FindingService!10.126.221.116!v3apifindingcore[]', 'guid': '14f63a2c-ffb0-a7ea-3304-9134ce2175ca', 'content-type': 'text/xml;charset=UTF-8', 'x-ebay-soa-response-data-format': 'XML', 'x-ebay-soa-service-metrics': '4251324'})
2015-08-25 12:24:18,809 ebaysdk [DEBUG]:content=<?xml version='1.0' encoding='UTF-8'?><errorMessage xmlns="http://www.ebay.com/marketplace/search/v1/services"><error><errorId>11002</errorId><domain>Security</domain><severity>Error</severity><category>System</category><message>Authentication failed : Invalid Application: test-08c4-473a-8461-415f8024798f</message><subdomain>Authentication</subdomain><parameter name="Param1">Invalid Application: test-08c4-473a-8461-415f8024798f</parameter></error></errorMessage>
2015-08-25 12:24:18,810 ebaysdk [ERROR]:findItemsAdvanced: Internal Server Error, Domain: Security, Severity: Error, errorId: 11002, Authentication failed : Invalid Application: test-08c4-473a-8461-415f8024798f
u'findItemsAdvanced: Internal Server Error, Domain: Security, Severity: Error, errorId: 11002, Authentication failed : Invalid Application: test-08c4-473a-8461-415f8024798f'
{'errorMessage': {'error': {'category': 'System', 'domain': 'Security', 'severity': 'Error', 'message': 'Authentication failed : Invalid Application: test-08c4-473a-8461-415f8024798f', 'subdomain': 'Authentication', 'parameter': {'value': 'Invalid Application: test-08c4-473a-8461-415f8024798f', '_name': 'Param1'}, 'errorId': '11002'}}}
Any guess? what I am missing?
Thanks in advance.
You are calling with ebay api by production environment. you need to call with sandbox credential. your credential may be correct but you need to change the domain. ebaysdk-python api is by default calling to production environment.
change the line by passing ebay sandbox endpoint in domain.
api = finding(domain='svcs.sandbox.ebay.com', debug=True, config_file='myebay.yaml')
It will give you response Ack Success,
Hope this helps.