Skip to content

Commit 7b24a4a

Browse files
authored
Update test_errors.py
1 parent ef78537 commit 7b24a4a

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

tests/test_errors.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# -*- coding: utf-8 -*-
2+
3+
'''
4+
Copyright 2012-2019 eBay Inc.
5+
Authored by: Tim Keefer
6+
Licensed under CDDL 1.0
7+
'''
8+
9+
from __future__ import absolute_import
10+
import os
11+
import unittest
12+
import ebaysdk.shopping
13+
import lxml
14+
15+
os.environ.setdefault("EBAY_YAML", "ebay.yaml")
16+
17+
class TestErrors(unittest.TestCase):
18+
19+
def DISABLE_test_single_item(self):
20+
connection = ebaysdk.shopping.Connection(version='799', config_file=os.environ.get('EBAY_YAML'))
21+
22+
for i in range(20):
23+
connection.execute('GetSingleItem', {
24+
'ItemID': '262809803926',
25+
'version': '981',
26+
'IncludeSelector': ['Variations']
27+
})
28+
self.assertEqual(connection.response.status_code, 200)
29+
self.assertEqual(type(connection.response.dom()), lxml.etree._Element)
30+
31+
if __name__ == '__main__':
32+
unittest.main()
33+
34+
"""
35+
<?xml version='1.0' encoding='utf-8'?><GetSingleItemRequest xmlns="urn:ebay:apis:eBLBaseComponents"><IncludeSelector>Variations</I
36+
ncludeSelector><ItemID>262809803926</ItemID><version>981</version></GetSingleItemRequest>
37+
2017-02-28 06:18:42,156 ebaysdk [DEBUG]:total time=0.478377819061
38+
2017-02-28 06:18:42,156 ebaysdk [DEBUG]:execute: verb=GetSingleItem data={'ItemID': '262809803926', 'version': 981, 'IncludeSelector': 'Variations'}
39+
2017-02-28 06:18:42,157 ebaysdk [DEBUG]:REQUEST (3ff5f071-04c3-40c0-a4f0-57f04a9e9972): POST http://open.api.ebay.com/shopping
40+
2017-02-28 06:18:42,157 ebaysdk [DEBUG]:headers={'Content-Length': '219', 'X-EBAY-API-REQUEST-ENCODING': 'XML', 'X-EBAY-API-VERSION': '799', 'User-Agent': 'eBaySDK/2.1.4 Pytho
41+
n/2.7.6 Linux/3.13.0-91-generic', 'X-EBAY-SDK-REQUEST-ID': '3ff5f071-04c3-40c0-a4f0-57f04a9e9972', 'X-EBAY-API-SITE-ID': '0', 'X-EBAY-API-CALL-NAME': 'GetSingleItem', 'Content
42+
-Type': 'text/xml', 'X-EBAY-API-APP-ID': 'asdf'}
43+
2017-02-28 06:18:42,157 ebaysdk [DEBUG]:body=<?xml version='1.0' encoding='utf-8'?><GetSingleItemRequest xmlns="urn:ebay:apis:eBLBaseComponents"><IncludeSelector>Variations</I
44+
ncludeSelector><ItemID>262809803926</ItemID><version>981</version></GetSingleItemRequest>
45+
2017-02-28 06:18:42,511 ebaysdk [DEBUG]:RESPONSE (3ff5f071-04c3-40c0-a4f0-57f04a9e9972):
46+
2017-02-28 06:18:42,511 ebaysdk [DEBUG]:elapsed time=0:00:00.354254
47+
2017-02-28 06:18:42,511 ebaysdk [DEBUG]:status code=500
48+
2017-02-28 06:18:42,511 ebaysdk [DEBUG]:headers={'breadcrumbid': 'ID-slc4b03c-6483-stratus-slc-ebay-com-53764-1487075486325-0-1105919761', 'content-length': '25', 'accept-enco
49+
ding': 'identity', 'x-ebay-api-request-encoding': 'XML', 'x-ebay-api-version': '799', 'user-agent': 'eBaySDK/2.1.4 Python/2.7.6 Linux/3.13.0-91-generic', 'connection': 'keep-a
50+
live', 'x-ebay-sdk-request-id': '3ff5f071-04c3-40c0-a4f0-57f04a9e9972', 'x-ebay-api-site-id': '0', 'x-ebay-api-call-name': 'GetSingleItem', 'content-type': 'text/plain;charset
51+
=utf-8', 'x-forwarded-for': '52.19.146.95', 'x-ebay-api-app-id': 'asdf'}
52+
2017-02-28 06:18:42,511 ebaysdk [DEBUG]:content=an internal error occured
53+
2017-02-28 06:18:42,512 ebaysdk [DEBUG]:response parse failed: Start tag expected, '<' not found, line 1, column 1
54+
ERROR - 2017-02-28 06:18:42,512 - utils.firehose_util - MainProcess - MainThread: Shopping Call error: {"ItemID": "262809803926", "version": 981, "IncludeSelector": "Variation
55+
s"}
56+
Traceback (most recent call last):
57+
File "/home/ubuntu/logograb2-detection-server/utils/firehose_util.py", line 235, in make_ebay_request
58+
r = Shopping(appid=app_id, config_file=None, debug=True).execute('GetSingleItem', api_pars)
59+
File "/usr/local/lib/python2.7/dist-packages/ebaysdk/connection.py", line 124, in execute
60+
self.error_check()
61+
File "/usr/local/lib/python2.7/dist-packages/ebaysdk/connection.py", line 209, in error_check
62+
estr = self.error()
63+
File "/usr/local/lib/python2.7/dist-packages/ebaysdk/connection.py", line 321, in error
64+
error_array.extend(self._get_resp_body_errors())
65+
File "/usr/local/lib/python2.7/dist-packages/ebaysdk/shopping/__init__.py", line 188, in _get_resp_body_errors
66+
dom = self.response.dom()
67+
File "/usr/local/lib/python2.7/dist-packages/ebaysdk/response.py", line 233, in dom
68+
return self._dom
69+
File "/usr/local/lib/python2.7/dist-packages/ebaysdk/response.py", line 220, in __getattr__
70+
return getattr(self._obj, name)
71+
AttributeError: 'Response' object has no attribute '_dom'
72+
"""

0 commit comments

Comments
 (0)