timotheus / ebaysdk-python

eBay API SDK for Python
https://developer.ebay.com/tools/sdks
Other
809 stars 326 forks source link

AttributeError: 'Response' object has no attribute '_dom' #229

Open ninamculver opened 6 years ago

ninamculver commented 6 years ago

Hello, I've been using the ebaySDK module for a while to use findItemsAdvanced. In the past this ran 100% fine however about 5% of the time I get the error listed above. I've included below a sample search I'm doing as well as the actual output. Error: Traceback (most recent call last):

File "", line 2, in response = api.execute('findItemsAdvanced', searchterms)

File "C:\Users\au1950\AppData\Local\Continuum\Anaconda3\lib\site-packages\ebaysdk\connection.py", line 127, in execute self.error_check()

File "C:\Users\au1950\AppData\Local\Continuum\Anaconda3\lib\site-packages\ebaysdk\connection.py", line 218, in error_check estr = self.error()

File "C:\Users\au1950\AppData\Local\Continuum\Anaconda3\lib\site-packages\ebaysdk\connection.py", line 334, in error error_array.extend(self._get_resp_body_errors())

File "C:\Users\au1950\AppData\Local\Continuum\Anaconda3\lib\site-packages\ebaysdk\finding__init__.py", line 227, in _get_resp_body_errors dom = self.response.dom()

File "C:\Users\au1950\AppData\Local\Continuum\Anaconda3\lib\site-packages\ebaysdk\response.py", line 239, in dom return self._dom

File "C:\Users\au1950\AppData\Local\Continuum\Anaconda3\lib\site-packages\ebaysdk\response.py", line 226, in getattr return getattr(self._obj, name)

AttributeError: 'Response' object has no attribute '_dom'

The code I'm submitting: api.execute('findItemsAdvanced',{'categoryId': '9355', 'keywords': '132497677096', 'outputSelector': ['item', 'SellerInfo'], 'sortOrder': 'BestMatch'})

Sorry, for some reason I can't insert formatted code. Thank you for your help.

fedeb95 commented 6 years ago

I get the same error with the following:

>>> api = Connection(appid='<app-id-here>',config_file=None, domain='sandbox.ebay.com')
>>> response = api.execute('findItemsAdvanced', {'keywords': 'legos'})

error:

File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.5-py2.7.egg/ebaysdk/connection.py", line 127, in execute
    self.error_check()
  File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.5-py2.7.egg/ebaysdk/connection.py", line 218, in error_check
    estr = self.error()
  File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.5-py2.7.egg/ebaysdk/connection.py", line 334, in error
    error_array.extend(self._get_resp_body_errors())
  File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.5-py2.7.egg/ebaysdk/finding/__init__.py", line 227, in _get_resp_body_errors
    dom = self.response.dom()
  File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.5-py2.7.egg/ebaysdk/response.py", line 239, in dom
    return self._dom
  File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.5-py2.7.egg/ebaysdk/response.py", line 226, in __getattr__
    return getattr(self._obj, name)
AttributeError: 'Response' object has no attribute '_dom'
shootin4aces commented 4 years ago

I am having a similar problem... has anyone found a solution? Mine is hit or miss. I will hit this error one run, and the next time it was work flawlessly on the same query. If I run the code multiple times I eventually get through (have a database to reduce the number of calls). So if I hit this error 1 run I likely will not hit it on the next (at least on the same call)

response_title = api.execute('findCompletedItems', requestApi)

File "C:\Users\XXXX\Documents\ClearancePalet\venv\lib\site-packages\ebaysdk\connection.py", line 127, in execute self.error_check() File "C:\Users\XXXX\Documents\ClearancePalet\venv\lib\site-packages\ebaysdk\connection.py", line 218, in error_check estr = self.error() File "C:\Users\XXXX\Documents\ClearancePalet\venv\lib\site-packages\ebaysdk\connection.py", line 334, in error error_array.extend(self._get_resp_body_errors()) File "C:\Users\XXXX\Documents\ClearancePalet\venv\lib\site-packages\ebaysdk\finding__init__.py", line 227, in _get_resp_body_errors dom = self.response.dom() File "C:\Users\XXXX\Documents\ClearancePalet\venv\lib\site-packages\ebaysdk\response.py", line 239, in dom return self._dom File "C:\Users\XXXX\Documents\ClearancePalet\venv\lib\site-packages\ebaysdk\response.py", line 226, in getattr return getattr(self._obj, name) AttributeError: 'Response' object has no attribute '_dom'

shootin4aces commented 4 years ago

@timotheus any ideas here by chance? the issue seems to have been open for awhile.

Thanks for the awesome code by the way!!!

timotheus commented 4 years ago

Hi -

This _dom error can be a service or network error. Enabling the full debug output can sometimes help track down the issue. Please remove all sensitive data (e.g. tokens) and I can help take a look at it.

-Tim

On Mon, Apr 13, 2020 at 3:12 PM shootin4aces notifications@github.com wrote:

@timotheus https://github.com/timotheus any ideas here by chance? the issue seems to have been open for awhile.

Thanks for the awesome code by the way!!!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/timotheus/ebaysdk-python/issues/229#issuecomment-613122960, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2QX6S4LU36XNNZTP3N6DRMOE6BANCNFSM4EQYB56Q .

shootin4aces commented 4 years ago

@timotheus Thankyou for the fast response!!! Somehow I didn't realize this was built in... definitely would have been very helpful a few times!

Here is the Debug output... It would appear I am getting a 404 error as the page is not found which would likely mean it is on ebay's side and not anything in the code... however, that being the case, I would like to be able to recover from this as opposed to the program ending. My call is already in a try block but the program just dies in the middle of response.py without hitting the catch.

How would you suggest catching this and attempting the query again because it will eventually work. (This _dom issue happens sporadically but enough to drive me insane)

Debug Log: 2020-04-13 19:17:57,928 ebaysdk [DEBUG]:execute: verb=findCompletedItems data={'keywords': 'HP OfficeJet All in One Wireless Printer', 'itemFilter': [{'name': 'condition', 'value': 'New'}, {'name': 'sellingStatus', 'value': 'EndedWithSales'}]}

2020-04-13 19:17:57,929 ebaysdk [DEBUG]:REQUEST (XXXXXXX): POST https://svcs.ebay.com/services/search/FindingService/v1

2020-04-13 19:17:57,929 ebaysdk [DEBUG]:headers={'X-EBAY-SOA-SERVICE-NAME': 'FindingService', 'X-EBAY-SOA-SERVICE-VERSION': '1.12.0', 'X-EBAY-SOA-SECURITY-APPNAME': XXXXXXX ', 'X-EBAY-SOA-GLOBAL-ID': 'EBAY-US', 'X-EBAY-SOA-OPERATION-NAME': 'findCompletedItems', 'X-EBAY-SOA-REQUEST-DATA-FORMAT': 'XML', 'X-EBAY-SOA-RESPONSE-DATA-FORMAT': 'XML', 'Content-Type': 'text/xml', 'User-Agent': 'eBaySDK/2.1.5 Python/3.7.4 Windows/10', 'X-EBAY-SDK-REQUEST-ID': XXXXXXX ', 'Content-Length': '358'}

2020-04-13 19:17:57,929 ebaysdk [DEBUG]:body=b'<?xml version=\'1.0\' encoding=\'utf-8\'?>conditionNewsellingStatusEndedWithSalesHP OfficeJet All in One Wireless Printer'

2020-04-13 19:17:58,244 ebaysdk [DEBUG]:RESPONSE (XXXXXXX): 2020-04-13 19:17:58,244 ebaysdk [DEBUG]:elapsed time=0:00:00.314884 2020-04-13 19:17:58,244 ebaysdk [DEBUG]:status code=404 2020-04-13 19:17:58,244 ebaysdk [DEBUG]:headers={'X-eBay-Client-TLS-Version': '771, 24.214.208.50', 'X-EBAY-REQUEST-ID': 'null![', 'RlogId': 't6bv%7Fi%60utn%60lh%609%3Fuk%60du%7Emfvujfoid%2852237%3E4-171760cbbbf-0x23e6', 'Content-Length': '245', 'Date': 'Tue, 14 Apr 2020 00:17:58 GMT', 'Server': 'ebay server'}

2020-04-13 19:17:58,244 ebaysdk [DEBUG]:content={"errors":[{"errorId":2002,"domain":"ACCESS","category":"REQUEST","message":"Resource not found","longMessage":"A resource (URI) associated with the request could not be resolved.","parameters":[{"name":"reason","value":"HTTP 404 Not Found"}]}]}

2020-04-13 19:17:58,245 ebaysdk [DEBUG]:response parse failed: Start tag expected, '<' not found, line 1, column 1 (, line 1)

Traceback (most recent call last): Can be seen in previous post