Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added OAuth 2.0 authorization to Shopping API#369

Open
xjxckk wants to merge 9 commits into
timotheus:master from
xjxckk:master
Open

Added OAuth 2.0 authorization to Shopping API #369
xjxckk wants to merge 9 commits into
timotheus:master from
xjxckk:master

Conversation

@xjxckk

@xjxckk xjxckk commented Feb 17, 2022

Copy link
Copy Markdown

Added OAuth 2.0 authorization to Shopping API.

Relevant issue: #347

@xjxckk xjxckk changed the title (削除) Add files via upload (削除ここまで) (追記) Added OAuth 2.0 authorization to Shopping API (追記ここまで) Feb 19, 2022

Copy link
Copy Markdown

Can someone explain me where an how I have to implement this token?
Also where i can get this token from :O

xjxckk commented May 12, 2022

Copy link
Copy Markdown
Author

You can install my fork, it will get the token for you.

If you want to do it yourself, you can read the discussion here: #347

paddisaap commented May 13, 2022
edited
Loading

Copy link
Copy Markdown

Thanks for the reply. I added your changes to the scripts but now i'm getting this:

Oauth2.0 token request response: {
 "error": "invalid_client",
 "error_description": "client authentication failed"
}
Traceback (most recent call last):
 File "/home/i430/VSCode/EBay Test API/ebaysdk new con file/finding-steuergeraete-61525.py", line 93, in <module>
 'IncludeSelector':'Details,Description,TextDescription,ShippingCosts,ItemSpecifics,Variations'})
 File "/home/i430/VSCode/EBay Test API/ebaysdk new con file/ebaysdk/connection.py", line 122, in execute
 self.build_request(verb, data, verb_attrs, files)
 File "/home/i430/VSCode/EBay Test API/ebaysdk new con file/ebaysdk/connection.py", line 141, in build_request
 headers = self.build_request_headers(verb)
 File "/home/i430/VSCode/EBay Test API/ebaysdk new con file/ebaysdk/shopping/__init__.py", line 183, in build_request_headers
 access_token = response_dict['access_token']
KeyError: 'access_token'

Any ideas how I can fix this?
And how do I have to configure my ebay.yaml file/ where do I have to put the OAuth Code in?

xjxckk commented May 13, 2022

Copy link
Copy Markdown
Author

I updated the imports to include requests for POST.

This is my YAML file:

# Shopping API
open.api.ebay.com:
 appid: 
 devid: 
 certid: 

Copy link
Copy Markdown

@timotheus Do you think you could have a look at this? Just ran into this issue.

av1d reacted with thumbs up emoji

Copy link
Copy Markdown

Would also like to see this feature implemented

av1d, jswanson, and tekgecko reacted with thumbs up emoji

atmosse commented Jan 12, 2023

Copy link
Copy Markdown

Thanks for the implementation! After reviewing this thread and implementing all suggestions, I generate the access token but end up running into this error:
image
I would appreciate any leads on how to fix this!

xjxckk commented Jan 12, 2023

Copy link
Copy Markdown
Author

Looks like theres some kind of other error occuring, best to go into the source and add prints to see whats going on in your system. I haven't looked at the code for a while.

Copy link
Copy Markdown

@xjxckk's fork has a nice solution, but a couple minor bugs. I got a similar error and made a couple minor changes to the code he provided to get it working. Might try my fork.

jswanson commented Feb 8, 2023

Copy link
Copy Markdown

Any hope for this fix? Seems like a straight forward approach to solve a problem many people are dealing with.

Copy link
Copy Markdown

@dannyo1987 - can you provide a quick guide on how to use your fork? For example, I am looking to use the GetShippingCost function.

Copy link
Copy Markdown

You don't have to do anything other than install the fork as a dependency and set up your configuration with your app_id and cert_id

dannyo1987 commented Mar 1, 2023
edited
Loading

Copy link
Copy Markdown

Someone at Ebay should really merge this @timotheus. This api is not that useful without this PR merged. And it's a really nice api, would hate to see it lose its utility!

vaibhavbafna5 commented Mar 9, 2023
edited
Loading

Copy link
Copy Markdown

atmosse

hey! i'm running into a similar issue - i'm able to generate my Oauth token successfully using the fork above + modifications, but when i make the request i get hit with a similar error. what did you do to resolve? pasting my approach below:

from ebaysdk.shopping import Connection as shopping
shopping_api = shopping(appid="XXX", config_file="ebay.yaml", debug=True)
response = shopping_api.execute('GetSingleItem', {
 'ItemID': item_id,
 })
print(response)

error:

2023年03月08日 20:47:25,522 ebaysdk [DEBUG]:REQUEST (c9cf2d53-b4d9-474a-bb1c-668abc521816): POST https://open.api.ebay.com/shopping
2023年03月08日 20:47:25,522 ebaysdk [DEBUG]:headers={'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Basic [oauth_token]', 'User-Agent': 'eBaySDK/2.2.0 Python/3.10.9 Darwin/20.3.0', 'X-EBAY-SDK-REQUEST-ID': 'c9cf2d53-b4d9-474a-bb1c-668abc521816', 'Content-Length': '152'}
2023年03月08日 20:47:25,529 ebaysdk [DEBUG]:body=b'<?xml version=\'1.0\' encoding=\'utf-8\'?><GetSingleItemRequest xmlns="urn:ebay:apis:eBLBaseComponents"><ItemID>334451252528</ItemID></GetSingleItemRequest>'
2023年03月08日 20:47:26,005 ebaysdk [DEBUG]:RESPONSE (c9cf2d53-b4d9-474a-bb1c-668abc521816):
2023年03月08日 20:47:26,006 ebaysdk [DEBUG]:elapsed time=0:00:00.475940
2023年03月08日 20:47:26,006 ebaysdk [DEBUG]:status code=404
2023年03月08日 20:47:26,006 ebaysdk [DEBUG]:headers={'date': 'Thu, 09 Mar 2023 01:47:27 GMT', 'server': 'ebay-proxy-server', 'content-length': '0', 'x-envoy-upstream-service-time': '10', 'x-ebay-pop-id': 'UFES2-RNOAZ03-openapi'}
2023年03月08日 20:47:26,006 ebaysdk [DEBUG]:content=
RESPONSE {'_content': b'', '_content_consumed': True, '_next': None, 'status_code': 404, 'headers': {'date': 'Thu, 09 Mar 2023 01:47:27 GMT', 'server': 'ebay-proxy-server', 'content-length': '0', 'x-envoy-upstream-service-time': '10', 'x-ebay-pop-id': 'UFES2-RNOAZ03-openapi'}, 'raw': <urllib3.response.HTTPResponse object at 0x103b252d0>, 'url': 'https://open.api.ebay.com/shopping', 'encoding': None, 'history': [], 'reason': 'Not Found', 'cookies': <RequestsCookieJar[]>, 'elapsed': datetime.timedelta(microseconds=475940), 'request': <PreparedRequest [POST]>, 'connection': <requests.adapters.HTTPAdapter object at 0x103aeff70>}
2023年03月08日 20:47:26,007 ebaysdk [DEBUG]:response parse failed: Document is empty, line 1, column 1 (<string>, line 1)
Traceback (most recent call last):
 File "/Users/vaibhav/projects/playground/ebay/dummy.py", line 7, in <module>
 response = shopping_api.execute('GetSingleItem', {
 File "/Users/vaibhav/projects/playground/ebay/venv/lib/python3.10/site-packages/ebaysdk-2.2.0-py3.10.egg/ebaysdk/connection.py", line 129, in execute
 self.error_check()
 File "/Users/vaibhav/projects/playground/ebay/venv/lib/python3.10/site-packages/ebaysdk-2.2.0-py3.10.egg/ebaysdk/connection.py", line 222, in error_check
 estr = self.error()
 File "/Users/vaibhav/projects/playground/ebay/venv/lib/python3.10/site-packages/ebaysdk-2.2.0-py3.10.egg/ebaysdk/connection.py", line 338, in error
 error_array.extend(self._get_resp_body_errors())
 File "/Users/vaibhav/projects/playground/ebay/venv/lib/python3.10/site-packages/ebaysdk-2.2.0-py3.10.egg/ebaysdk/shopping/__init__.py", line 291, in _get_resp_body_errors
 if self.response.reply.Ack == 'Failure':
AttributeError: 'ResponseDataObject' object has no attribute 'Ack'

Copy link
Copy Markdown

I have the also issue with this branch :

2023年04月18日 13:05:57,581 ebaysdk [DEBUG]:execute: verb=GetSingleItem data={'ItemID': '175690456463'}
{'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Basic ......'} grant_type=client_credentials&scope=https%3A%2F%2Fapi.ebay.com%2Foauth%2Fapi_scope
Oauth2.0 token request response: {
 "error": "server_error",
 "error_description": "server encountered an unexpected condition that prevented it from fulfilling the request"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /