Discogspy is a type-safe and easy to use python wrapper around the Discogs API.
What's the use case for discogspy?
I have a small label/distro, and I sell my items via Discogs and my own website. To keep both stores in sync is tidies. That's why I want to automate this process. Therefore I need to be able to get information from my Discogs store. That can be done via the official Discogs python client. However, I also need to be able to update orders, add and remove items etc. and this doesn't seem to work via the Discogs python client. That's why I decided to wrap the Discogs API myself.
Important information:
Requests to the Discogs API are throttled by the server by source IP to 60 per minute for authenticated requests, and 25 per minute for unauthenticated requests, with some exceptions.
pip install discogspy
-
Create type save python wrapper around the Discogs API
a) Wrap database calls (done - except search request cause I personally dont have any use case for it)
b) Wrap marketplace calls (done)
c) Wrap inventory export calls (done)
d) Wrap inventory upload calls (done)
e) Wrap user identity calls (maybe later - I personally dont have any use case for it)
f) Wrap user collection calls (done)
g) Wrap user wantlist calls (done)
h) Wrap user lists calls (done) -
Create response wrapper
For a detailed explanation and more examples, please visit the documentation.
Currently, you have two options for starting requests to Discogs.
- Create a user object without authentication. This will limit your options cause a lot of API calls do require authentication.
from discogspy.core.discogs_user import UserWithoutAuthentication
from discogspy.core import rq_database
user = UserWithoutAuthentication()
resp = rq_database.get_release(user, 1972502)
- Create a user object with user token authentication. This will allow you to send any request.
from discogspy.core.discogs_user import UserWithUserTokenBasedAuthentication
from discogspy.core import rq_database
user_with_authentication = UserWithUserTokenBasedAuthentication(user_token="your_user_token",
user_agent="your_user_agent")
resp = rq_database.get_release(user, 1972502)