As an authenticated user you can add, edit and delete your own marketplace
from discogs_client import Client, Condition, Status, Sort d = Client('user-agent', user_token='my_user_token') me = d.identity() me.inventory.add_listing( release=15246519, # Also accepts an Release object condition=Condition.MINT, # condition set to 'Mint (M)' price=29.99, status=Status.DRAFT, # status set to 'Draft' sleeve_condition=Condition.NEAR_MINT # sleeve condition set to 'Near Mint (NM or M-)' )
You do not have to be authenticated to read a user’s public inventory.
user = d.user('username') # gets a user with username inventory = user.inventory # get that user's inventory first_page = inventory.page(0) # get the first page first_listing = first_page # get the first listing from that page release = first_listing.release # get the release from the release
Get the most expensive listing and update its price.
inventory = me.inventory # Get up to date inventory inventory.sort( # Sort by price in descending order Sort.By.PRICE, # == 'price' Sort.Order.DESCENDING) # == 'desc' listing = inventory # Get the first item, i.e. most expensive listing.price = 34.99 # Update its price listing.save() # Save changes made to listing
See the module documentation for possible values of sort criteria and sort
Listing object as described in the previous example and call
to remove it.