python3-discogs-client 2.7.1__tar.gz → 2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/PKG-INFO +10 -2
  2. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/__init__.py +1 -1
  3. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/models.py +25 -5
  4. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/test_models.py +36 -2
  5. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/python3_discogs_client.egg-info/PKG-INFO +10 -2
  6. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/setup.py +1 -1
  7. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/LICENSE +0 -0
  8. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/MANIFEST.in +0 -0
  9. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/client.py +0 -0
  10. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/exceptions.py +0 -0
  11. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/fetchers.py +0 -0
  12. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/__init__.py +0 -0
  13. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/artists/1/releases_per_page=50&page=1.json +0 -0
  14. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/artists/1/releases_per_page=50&page=2.json +0 -0
  15. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/artists/1.json +0 -0
  16. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/artists/2.json +0 -0
  17. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/artists/3.json +0 -0
  18. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/database/search_artist=trash80&per_page=50&page=1.json +0 -0
  19. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/database/search_artist=trash80&title=icarus&per_page=50&page=1.json +0 -0
  20. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/database/search_q=trash%2080&per_page=50&page=1.json +0 -0
  21. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/database/search_q=trash80&per_page=50&page=1.json +0 -0
  22. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/labels/1.json +0 -0
  23. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/labels/31405.json +0 -0
  24. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/lists/1.json +0 -0
  25. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/marketplace/fee/20.5000/EUR.json +0 -0
  26. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/marketplace/listings/150899904.json +0 -0
  27. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/marketplace/stats/1.json +0 -0
  28. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/masters/4242/versions_per_page=50&page=1.json +0 -0
  29. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/masters/4242.json +0 -0
  30. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/oauth/identity.json +0 -0
  31. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/releases/1.json +0 -0
  32. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/releases/2.json +0 -0
  33. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/releases/3.json +0 -0
  34. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/releases/3329867.json +0 -0
  35. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/releases/79.json +0 -0
  36. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/users/example/collection/folders/0/releases_page=1&per_page=50.json +0 -0
  37. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/users/example/collection/folders.json +0 -0
  38. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/users/example/collection/value.json +0 -0
  39. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/users/example/inventory_per_page=50&page=1.json +0 -0
  40. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/users/example/wants_per_page=50&page=1.json +0 -0
  41. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/res/users/example.json +0 -0
  42. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/test_core.py +0 -0
  43. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/test_fetchers.py +0 -0
  44. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/tests/test_utils.py +0 -0
  45. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/discogs_client/utils.py +0 -0
  46. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/python3_discogs_client.egg-info/SOURCES.txt +0 -0
  47. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/python3_discogs_client.egg-info/dependency_links.txt +0 -0
  48. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/python3_discogs_client.egg-info/requires.txt +0 -0
  49. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/python3_discogs_client.egg-info/top_level.txt +0 -0
  50. {python3_discogs_client-2.7.1 → python3_discogs_client-2.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: python3-discogs-client
3
- Version: 2.7.1
3
+ Version: 2.8
4
4
  Summary: Python API client for Discogs
5
5
  Home-page: https://github.com/joalla/discogs_client
6
6
  Author: joalla
@@ -21,5 +21,13 @@ Provides-Extra: docs
21
21
  Requires-Dist: sphinx; extra == "docs"
22
22
  Requires-Dist: pydata-sphinx-theme; extra == "docs"
23
23
  Requires-Dist: myst-parser; extra == "docs"
24
+ Dynamic: author
25
+ Dynamic: author-email
26
+ Dynamic: classifier
27
+ Dynamic: description
28
+ Dynamic: home-page
29
+ Dynamic: provides-extra
30
+ Dynamic: requires-dist
31
+ Dynamic: summary
24
32
 
25
33
  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. Please visit: https://github.com/joalla/discogs_client for more information.
@@ -1,4 +1,4 @@
1
- __version__ = '2.7.1'
1
+ __version__ = '2.8'
2
2
  __version_info__ = tuple(int(i) for i in __version__.split('.') if i.isdigit())
3
3
 
4
4
  from discogs_client.client import Client
@@ -745,7 +745,7 @@ class CollectionFolder(PrimaryAPIObject):
745
745
  count = SimpleField() #:
746
746
 
747
747
  def __init__(self, client, dict_):
748
- super(CollectionFolder, self).__init__(client, dict_)
748
+ super().__init__(client, dict_)
749
749
 
750
750
  @property
751
751
  def releases(self):
@@ -754,14 +754,34 @@ class CollectionFolder(PrimaryAPIObject):
754
754
 
755
755
  def add_release(self, release):
756
756
  release_id = release.id if isinstance(release, Release) else release
757
- add_release_url = self.fetch('resource_url') + '/releases/{}'.format(release_id)
758
- self.client._post(add_release_url, None)
757
+ resource_url = self.fetch('resource_url')
758
+ self.client._post(f"{resource_url}/releases/{release_id}", None)
759
759
 
760
760
  def remove_release(self, instance):
761
+ """Remove a collection item entirely.
762
+ """
761
763
  if not isinstance(instance, CollectionItemInstance):
762
764
  raise TypeError('instance must be of type CollectionItemInstance')
763
- instance_url = self.fetch('resource_url') + '/releases/{0}/instances/{1}'.format(instance.id, instance.instance_id)
764
- self.client._delete(instance_url)
765
+ resource_url = self.fetch('resource_url')
766
+ self.client._delete(f"{resource_url}/releases/{instance.id}/instances/{instance.instance_id}")
767
+
768
+ def move_release(self, instance, target_folder_id):
769
+ """Move a collection item to another folder.
770
+
771
+ Moving to folder id 1 moves to the "Uncategorized" folder.
772
+ """
773
+ if not isinstance(instance, CollectionItemInstance):
774
+ raise TypeError('instance must be of type CollectionItemInstance')
775
+ resource_url = self.fetch('resource_url')
776
+ self.client._post(
777
+ f"{resource_url}/releases/{instance.id}/instances/{instance.instance_id}",
778
+ {"folder_id": target_folder_id},
779
+ )
780
+
781
+ def uncategorize_release(self, instance):
782
+ """Move a collection item to the "Uncategorized" folder.
783
+ """
784
+ self.move_release(instance, 1)
765
785
 
766
786
  def __repr__(self):
767
787
  return '<CollectionFolder {0!r} {1!r}>'.format(self.id, self.name)
@@ -1,5 +1,5 @@
1
1
  import unittest
2
- from discogs_client.models import Artist, Release, ListItem, CollectionValue
2
+ from discogs_client.models import Artist, Release, ListItem, CollectionValue, CollectionItemInstance
3
3
  from discogs_client.tests import DiscogsClientTestCase
4
4
  from discogs_client.exceptions import HTTPError
5
5
 
@@ -265,7 +265,6 @@ class ModelsTestCase(DiscogsClientTestCase):
265
265
  self.assertEqual(method, 'GET')
266
266
  self.assertEqual(url, '/marketplace/listings/150899904')
267
267
 
268
-
269
268
  def test_collection(self):
270
269
  """Collection folders can be manipulated"""
271
270
  # Fetch the users collection folders from the filesystem
@@ -314,6 +313,41 @@ class ModelsTestCase(DiscogsClientTestCase):
314
313
  self.assertEqual(method, 'POST')
315
314
  self.assertEqual(url, '/users/example/collection/folders/1/releases/1')
316
315
 
316
+ def test_collection_move_release(self):
317
+ """Collection items can be moved to another folder"""
318
+ # Fetch the users collection folders from the filesystem
319
+ u = self.d.user("example")
320
+ self.assertEqual(u.collection_folders[2].id, 2)
321
+
322
+ # Mock expected responses for move_release test using "MemoryFetcher"
323
+ self.m._fetcher.fetcher.responses = {
324
+ "/users/example/collection/folders": (b'''
325
+ {"folders": [
326
+ {"resource_url": "/users/example/collection/folders/0", "id": 0, "name": "All"},
327
+ {"resource_url": "/users/example/collection/folders/1", "id": 1, "name": "Uncategorized folder"},
328
+ {"resource_url": "/users/example/collection/folders/2", "id": 2, "name": "Collection folder 2"}
329
+ ]}
330
+ ''', 200),
331
+ # Mock the response of the POST request to the instance resource URL
332
+ "/users/example/collection/folders/1/releases/123456/instances/123": (b"", 204),
333
+ }
334
+
335
+ # Bind the user to the MemoryFetcher
336
+ u.client = self.m
337
+
338
+ # Mock a collection item instance
339
+ instance = CollectionItemInstance(
340
+ client=u.client,
341
+ dict_={"id": 123456, "instance_id": 123}
342
+ )
343
+ # Perform the move
344
+ u.collection_folders[1].move_release(instance, 2)
345
+
346
+ # Verify
347
+ method, url, _, _ = self.m._fetcher.last_request
348
+ self.assertEqual(method, "POST")
349
+ self.assertEqual(url, "/users/example/collection/folders/1/releases/123456/instances/123")
350
+
317
351
  def test_delete_object(self):
318
352
  """Can request DELETE on an APIObject"""
319
353
  u = self.d.user('example')
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: python3-discogs-client
3
- Version: 2.7.1
3
+ Version: 2.8
4
4
  Summary: Python API client for Discogs
5
5
  Home-page: https://github.com/joalla/discogs_client
6
6
  Author: joalla
@@ -21,5 +21,13 @@ Provides-Extra: docs
21
21
  Requires-Dist: sphinx; extra == "docs"
22
22
  Requires-Dist: pydata-sphinx-theme; extra == "docs"
23
23
  Requires-Dist: myst-parser; extra == "docs"
24
+ Dynamic: author
25
+ Dynamic: author-email
26
+ Dynamic: classifier
27
+ Dynamic: description
28
+ Dynamic: home-page
29
+ Dynamic: provides-extra
30
+ Dynamic: requires-dist
31
+ Dynamic: summary
24
32
 
25
33
  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. Please visit: https://github.com/joalla/discogs_client for more information.
@@ -4,7 +4,7 @@ from setuptools import setup
4
4
 
5
5
  setup(
6
6
  name='python3-discogs-client',
7
- version='2.7.1',
7
+ version='2.8',
8
8
  description='Python API client for Discogs',
9
9
  long_description='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. Please visit: https://github.com/joalla/discogs_client for more information.',
10
10
  url='https://github.com/joalla/discogs_client',