Marketplace listing

As an authenticated user you can add, edit and delete your own marketplace Listings.

Add

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-)'
)

See the module documentation for possible values of condition discogs_client.utils.Condition and status discogs_client.utils.Status.

Read

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[0]     # get the first listing from that page
release = first_listing.release   # get the release from the release

Update

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[0]      # 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 order discogs_client.utils.Sort.

Delete

Instantiate a Listing object as described in the previous example and call

listing.delete()

to remove it.

More information

View the module documentation at discogs_client.models.Inventory and discogs_client.models.Listing