discogs_client.client module#
- class discogs_client.client.Client(user_agent, consumer_key=None, consumer_secret=None, token=None, secret=None, user_token=None)#
Bases:
object
An interface to the Discogs API.
- _base_url = 'https://api.discogs.com'#
- _request_token_url = 'https://api.discogs.com/oauth/request_token'#
- _authorize_url = 'https://www.discogs.com/oauth/authorize'#
- _access_token_url = 'https://api.discogs.com/oauth/access_token'#
- set_consumer_key(consumer_key, consumer_secret)#
- set_token(token, secret)#
- get_authorize_url(callback_url=None)#
Returns a tuple of (<access_token>, <access_secret>, <authorize_url>). Send a Discogs user to the authorize URL to get the verifier for the access token.
- get_access_token(verifier)#
Uses the verifier to exchange a request token for an access token.
- _check_user_agent()#
- _request(method, url, data=None)#
- _get(url)#
- _delete(url)#
- _post(url, data)#
- _patch(url, data)#
- _put(url, data)#
- search(*query, **fields)#
Search the Discogs database. Returns a paginated list of objects (Artists, Releases, Masters, and Labels). The keyword arguments to this function are serialized into the request’s query string.
- artist(id)#
Fetch an Artist by ID.
- release(id)#
Fetch a Release by ID.
- master(id)#
Fetch a Master by ID.
- label(id)#
Fetch a Label by ID.
- list(id)#
Fetch a List by ID.
- user(username)#
Fetch a User by username.
- listing(id)#
Fetch a Marketplace Listing by ID.
- order(id)#
Fetch an Order by ID.
- fee_for(price, currency='USD')#
Calculate the fee for selling an item on the Marketplace.
- identity()#
Return a User object representing the OAuth-authorized user.
- property backoff_enabled: bool#
- property connection_timeout#
Return current client connection timeout
- property read_timeout#
Return current client read timeout
- set_timeout(connect: int | float = 5, read: int | float = 10) None #
Set request timeout parameters
- Parameters:
connect ((Union[int, float], optional)) – Time in seconds after which connect will timeout. Defaults to 5.
read ((Union[int, float], optional)) – Time in seconds after which request will timeout. Defaults to 10.