Skip to content Skip to sidebar Skip to footer

Oauth Authentication For Magiccardmarket With Python Requests

I want to programmatically fetch the stock of specific users on http://www.cardmarket.com/, but can't seem to get OAuth authentication to work in the following Python snippet. Simp

Solution 1:

Question: fetch the stock of specific users

Cardmarket RESTful API Documentation (Version 2.0)

Python wrapper for the cardmarket.com API (version 2.0, using OAuth1)

Requests-OAuthlib: OAuth for Humans


Using OAuth1Session:

from requests_oauthlib import OAuth1Session

# base_url = 'https://api.cardmarket.com/ws/v2.0/output.json'
base_url = 'https://api.cardmarket.com/ws/v2.0'# product_id = 266361 # Mandatory# url = '{}/articles/{}'.format(base_url, product_id)

user_id = 266361# Mandatory  Type: integer (ID) or string (name)
url = '{}/users/:{}/articles'.format(base_url, user_id)

oauth = OAuth1Session('app_token',
                       client_secret='app_secret',
                       resource_owner_key='access_token',
                       resource_owner_secret='access_token_secret',
                       realm=url
                      )

params = {'start':0, 'maxResults':100}
r = oauth.get(url, params=params)

Post a Comment for "Oauth Authentication For Magiccardmarket With Python Requests"