pax_global_header00006660000000000000000000000064137637112710014522gustar00rootroot0000000000000052 comment=857dc0475786cc7f289ea8534ff454d7dbb8552c python-discogs-client-2.3.5/000077500000000000000000000000001376371127100157575ustar00rootroot00000000000000python-discogs-client-2.3.5/.gitignore000066400000000000000000000001031376371127100177410ustar00rootroot00000000000000*.pyc *.egg-info dist/ .DS_Store .mypy_cache .coverage env/ build/ python-discogs-client-2.3.5/.travis.yml000066400000000000000000000005241376371127100200710ustar00rootroot00000000000000language: python python: - "3.6" - "3.7" - "3.8" - "3.9" install: - pip install -r requirements.txt script: | if [ $(python -c "import sys; print(sys.version_info.minor)") -lt 7 ]; then nosetests else nosetests --with-coverage --cover-package=discogs_client fi after_success: - coveralls python-discogs-client-2.3.5/LICENSE000066400000000000000000000026571376371127100167760ustar00rootroot00000000000000Copyright © 2015 Discogs. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY DISCOGS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DISCOGS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Discogs. python-discogs-client-2.3.5/MANIFEST.in000066400000000000000000000002271376371127100175160ustar00rootroot00000000000000recursive-include discogs_client/tests *.py recursive-include discogs_client/tests/res *.json recursive-exclude discogs_client/tests make_symlinks.py python-discogs-client-2.3.5/Makefile000066400000000000000000000001261376371127100174160ustar00rootroot00000000000000.PHONY: clean clean: find . -name '*.pyc' -delete find . -name __pycache__ -delete python-discogs-client-2.3.5/README.mkd000066400000000000000000000136561376371127100174240ustar00rootroot00000000000000# python3-discogs-client This is an active fork of the official "Discogs API client for Python", which was deprecated by discogs.com as of June 2020. We think it is a very useful Python module and decided to continue maintaining it. If you'd like to contribute your code, you are very welcome to submit a pull-request as described [here](#contributing). [python3-discogs-client](https://pypi.org/project/python3-discogs-client/) enables you to query the Discogs database (discogs.com) through its REST-API for information on artists, releases, labels, users, Marketplace listings, and more. It also supports OAuth 1.0a authorization, which allows you to change user data such as profile information, collections and wantlists, inventory, and orders. Find usage information on this README page or search and ask in the API section of the Discogs developer forum at https://www.discogs.com/forum/topic/1082. [![Build Status](https://travis-ci.org/joalla/discogs_client.svg?branch=master)](https://travis-ci.org/joalla/discogs_client) [![Coverage Status](https://coveralls.io/repos/github/joalla/discogs_client/badge.svg)](https://coveralls.io/github/joalla/discogs_client) ## Installation Install [the client from PyPI](https://pypi.org/project/python3-discogs-client/) using your favorite package manager. ```sh $ pip install python3-discogs-client ``` ## Quickstart ### Instantiating the client object ```python >>> import discogs_client >>> d = discogs_client.Client('ExampleApplication/0.1') ``` ### Authorization (optional) There are a couple of different authorization methods you can choose from depending on your requirements. #### OAuth authentication #### This method will allow your application to make requests on behalf of any user who logs in. For this, specify your app's consumer key and secret: ```python >>> d.set_consumer_key('key-here', 'secret-here') >>> # Or you can do this when you instantiate the Client ``` Then go through the OAuth 1.0a process. In a web app, we'd specify a `callback_url`. In this example, we'll use the OOB flow. ```python >>> d.get_authorize_url() ('request-token', 'request-secret', 'authorize-url-here') ``` The client will hang on to the access token and secret, but in a web app, you'd want to persist those and pass them into a new `Client` instance on the next request. Next, visit the authorize URL, authenticate as a Discogs user, and get the verifier: ```python >>> d.get_access_token('verifier-here') ('access-token-here', 'access-secret-here') ``` Now you can make requests on behalf of the user. ```python >>> me = d.identity() >>> "I'm {0} ({1}) from {2}.".format(me.name, me.username, me.location) u"I'm Joe Bloggs (example) from Portland, Oregon." >>> len(me.wantlist) 3 >>> me.wantlist.add(d.release(5)) >>> len(me.wantlist) 4 ``` #### User-token authentication #### This is one of the simplest ways to authenticate and become able to perform requests requiring authentication, such as search (see below). The downside is that you'll be limited to the information only your user account can see (i.e., no requests on behalf of other users). For this, you'll need to generate a user-token from your developer settings on the Discogs website. ```python >>> d = discogs_client.Client('ExampleApplication/0.1', user_token="my_user_token") ``` ### Fetching data Use methods on the client to fetch objects. You can search for objects: ```python >>> results = d.search('Stockholm By Night', type='release') >>> results.pages 1 >>> artist = results[0].artists[0] >>> artist.name u'Persuader, The' ``` Or fetch them by ID: ```python >>> artist.id 1 >>> artist == d.artist(1) True ``` You can drill down as far as you like. ```python >>> releases = d.search('Bit Shifter', type='artist')[0].releases[1].\ ... versions[0].labels[0].releases >>> len(releases) 134 ``` ## Artist Query for an artist using the artist's name: >>> artist = d.artist(956139) >>> print artist >>> 'name' in artist.data.keys() True ### Special properties Get a list of `Artist`s representing this artist's aliases: >>> artist.aliases [...] Get a list of `Release`s by this artist by page number: >>> artist.releases.page(1) [...] ## Release Query for a release using its Discogs ID: >>> release = d.release(221824) ### Special properties Get the title of this `Release`: >>> release.title u'...' Get a list of all `Artist`s associated with this `Release`: >>> release.artists [] Get the tracklist for this `Release`: >>> release.tracklist [...] Get the `MasterRelease` for this `Release`: >>> release.master Get a list of all `Label`s for this `Release`: >>> release.labels [...] ## MasterRelease Query for a master release using its Discogs ID: >>> master_release = d.master(120735) ### Special properties Get the key `Release` for this `MasterRelease`: >>> master_release.main_release Get the title of this `MasterRelease`: >>> master_release.title u'...' >>> master_release.title == master_release.main_release.title True Get a list of `Release`s representing other versions of this `MasterRelease` by page number: >>> master_release.versions.page(1) [...] Get the tracklist for this `MasterRelease`: >>> master_release.tracklist [...] ## Label Query for a label using the label's name: >>> label = d.label(6170) ### Special properties Get a list of `Release`s from this `Label` by page number: >>> label.releases.page(1) [...] Get a list of `Label`s representing sublabels associated with this `Label`: >>> label.sublabels [...] Get the `Label`'s parent label, if it exists: >>> label.parent_label