discogs-sdk 0.3.0__tar.gz → 0.4.0__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 (74) hide show
  1. discogs_sdk-0.4.0/LICENSE.txt +201 -0
  2. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/PKG-INFO +83 -31
  3. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/README.md +78 -28
  4. discogs_sdk-0.4.0/pyproject.toml +121 -0
  5. discogs_sdk-0.4.0/pyproject.toml.orig +147 -0
  6. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/__init__.py +27 -5
  7. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/_client.py +130 -50
  8. discogs_sdk-0.4.0/src/discogs_sdk/_async/_lazy.py +112 -0
  9. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/_oauth.py +10 -19
  10. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/_paginator.py +32 -7
  11. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/_resource.py +16 -26
  12. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/resources/artists.py +30 -10
  13. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/resources/collection.py +82 -34
  14. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/resources/exports.py +7 -8
  15. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/resources/labels.py +22 -9
  16. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/resources/lists.py +6 -6
  17. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/resources/marketplace.py +73 -31
  18. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/resources/masters.py +26 -9
  19. discogs_sdk-0.4.0/src/discogs_sdk/_async/resources/releases.py +156 -0
  20. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/resources/uploads.py +9 -12
  21. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/resources/users.py +69 -25
  22. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/resources/wantlist.py +13 -6
  23. discogs_sdk-0.4.0/src/discogs_sdk/_base_client.py +377 -0
  24. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_cache.py +22 -7
  25. discogs_sdk-0.4.0/src/discogs_sdk/_oauth_types.py +22 -0
  26. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/_client.py +120 -33
  27. discogs_sdk-0.4.0/src/discogs_sdk/_sync/_lazy.py +87 -0
  28. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/_oauth.py +30 -23
  29. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/_paginator.py +37 -8
  30. discogs_sdk-0.4.0/src/discogs_sdk/_sync/_resource.py +81 -0
  31. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/resources/artists.py +32 -8
  32. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/resources/collection.py +97 -32
  33. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/resources/exports.py +17 -6
  34. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/resources/labels.py +27 -8
  35. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/resources/lists.py +11 -3
  36. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/resources/marketplace.py +88 -24
  37. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/resources/masters.py +28 -7
  38. discogs_sdk-0.4.0/src/discogs_sdk/_sync/resources/releases.py +162 -0
  39. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/resources/search.py +7 -1
  40. discogs_sdk-0.4.0/src/discogs_sdk/_sync/resources/uploads.py +40 -0
  41. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/resources/users.py +78 -27
  42. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/resources/wantlist.py +23 -8
  43. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/models/__init__.py +23 -4
  44. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/models/_common.py +29 -6
  45. discogs_sdk-0.4.0/src/discogs_sdk/models/_lazy_fields.py +344 -0
  46. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/models/artist.py +3 -1
  47. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/models/collection.py +19 -3
  48. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/models/label.py +3 -1
  49. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/models/list_.py +3 -2
  50. discogs_sdk-0.4.0/src/discogs_sdk/models/marketplace.py +169 -0
  51. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/models/master.py +13 -3
  52. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/models/release.py +4 -1
  53. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/models/search.py +6 -3
  54. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/models/upload.py +2 -3
  55. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/models/user.py +2 -0
  56. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/oauth.py +7 -6
  57. discogs_sdk-0.3.0/pyproject.toml +0 -79
  58. discogs_sdk-0.3.0/src/discogs_sdk/_async/_lazy.py +0 -94
  59. discogs_sdk-0.3.0/src/discogs_sdk/_async/resources/releases.py +0 -96
  60. discogs_sdk-0.3.0/src/discogs_sdk/_base_client.py +0 -182
  61. discogs_sdk-0.3.0/src/discogs_sdk/_sync/_lazy.py +0 -72
  62. discogs_sdk-0.3.0/src/discogs_sdk/_sync/_resource.py +0 -66
  63. discogs_sdk-0.3.0/src/discogs_sdk/_sync/resources/releases.py +0 -81
  64. discogs_sdk-0.3.0/src/discogs_sdk/_sync/resources/uploads.py +0 -31
  65. discogs_sdk-0.3.0/src/discogs_sdk/models/marketplace.py +0 -90
  66. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/__init__.py +0 -0
  67. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/resources/__init__.py +4 -4
  68. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_async/resources/search.py +0 -0
  69. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_exceptions.py +0 -0
  70. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/__init__.py +0 -0
  71. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/_sync/resources/__init__.py +4 -4
  72. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/models/export.py +0 -0
  73. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/models/wantlist.py +0 -0
  74. {discogs_sdk-0.3.0 → discogs_sdk-0.4.0}/src/discogs_sdk/py.typed +0 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Jean-Marc Fontaine
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -1,23 +1,25 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: discogs-sdk
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Modern Python client for the Discogs API
5
5
  Keywords: api,discogs,music,python,sdk
6
6
  Author: Jean-Marc Fontaine
7
7
  Author-email: Jean-Marc Fontaine <jm@jmfontaine.net>
8
8
  License-Expression: Apache-2.0
9
+ License-File: LICENSE.txt
9
10
  Classifier: Development Status :: 3 - Alpha
10
11
  Classifier: Intended Audience :: Developers
11
- Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Programming Language :: Python :: 3 :: Only
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Programming Language :: Python :: 3.13
17
17
  Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Programming Language :: Python :: 3.15
18
19
  Classifier: Typing :: Typed
19
- Requires-Dist: httpx>=0.28
20
+ Requires-Dist: httpx2>=2.12
20
21
  Requires-Dist: pydantic>=2.12
22
+ Requires-Dist: pydantic>=2.14.0b2,<2.15 ; python_full_version == '3.15.*'
21
23
  Requires-Dist: typing-extensions>=4
22
24
  Requires-Python: >=3.10
23
25
  Project-URL: Homepage, https://github.com/jmfontaine/discogs-sdk
@@ -35,7 +37,7 @@ Description-Content-Type: text/markdown
35
37
  <a href="https://github.com/jmfontaine/discogs-sdk/blob/main/LICENSE.txt"><img src="https://img.shields.io/pypi/l/discogs-sdk.svg" alt="License"></a>
36
38
  </p>
37
39
 
38
- discogs-sdk is a modern Python client for the [Discogs API](https://www.discogs.com/developers) with full endpoint coverage, a fluent chainable syntax, and built-in response caching.
40
+ discogs-sdk is a modern Python client for the [Discogs API](https://www.discogs.com/developers) covering every documented v2 endpoint, with a fluent chainable syntax and built-in response caching.
39
41
 
40
42
  ```python
41
43
  from discogs_sdk import Discogs
@@ -60,11 +62,11 @@ Requires Python 3.10+.
60
62
 
61
63
  ## Features
62
64
 
63
- - **Full API Coverage** — Every endpoint in the Discogs API v2
65
+ - **Complete Endpoint Coverage** — Every route in the Discogs API v2 documentation
64
66
  - **Fluent API** — Chain sub-resources naturally: `client.releases.get(id).rating.get()`
65
67
  - **Lazy Loading** — No HTTP calls until you actually need the data
66
68
  - **Effortless Pagination** — Browse results without managing pages or offsets
67
- - **Rate Limit Friendly** — Automatically stay within API limits
69
+ - **Rate Limit Aware** — Bounded retries with `Retry-After` support
68
70
  - **Built-in Caching** — Optional TTL-based caching reduces API calls
69
71
  - **Flexible Auth** — Supports personal tokens, consumer key/secret, or full OAuth 1.0a
70
72
  - **Type Safe** — Get autocomplete and IDE support
@@ -72,17 +74,18 @@ Requires Python 3.10+.
72
74
 
73
75
  ### How it compares
74
76
 
77
+ The established alternative is [python3-discogs-client](https://github.com/joalla/discogs_client). Both load data
78
+ lazily, paginate automatically, support OAuth 1.0a and back off on HTTP 429, so the differences that matter are:
79
+
75
80
  | | discogs-sdk | python3-discogs-client |
76
81
  |---|---|---|
77
- | Full API coverage | ✓ | Partial |
78
- | Fluent sub-resource chaining | ✓ | ✗ |
79
- | Lazy loading | ✓ | ✗ |
80
- | Auto-pagination | ✓ | ✓ |
81
- | Automatic rate limit handling | ✓ | ✗ |
82
- | Caching | ✓ | ✗ |
83
- | OAuth 1.0a | ✓ | ✓ |
84
- | Type safe (Pydantic models) | ✓ | ✗ |
85
- | Async & sync | ✓ | ✗ |
82
+ | Documented v2 API coverage | Complete | Partial † |
83
+ | Sync and async | Both | Sync only |
84
+ | Responses | Typed Pydantic models | Untyped attributes |
85
+ | Response cache | In-memory or SQLite | None |
86
+
87
+ † No inventory export or upload, release ratings or have/want stats, collection fields, folder creation,
88
+ contributions or submissions.
86
89
 
87
90
  ## Quick start
88
91
 
@@ -106,15 +109,34 @@ You can also pass credentials explicitly:
106
109
  client = Discogs(token="your-token-here")
107
110
  ```
108
111
 
109
- The SDK supports three auth modes: personal token, consumer key/secret, and OAuth 1.0a. Credentials passed to the constructor take precedence over environment variables (`DISCOGS_TOKEN`, `DISCOGS_CONSUMER_KEY`, etc.). See [`examples/authentication.py`](examples/authentication.py) for the full OAuth flow.
112
+ The SDK supports three auth modes: personal token, consumer key/secret, and OAuth 1.0a. Exactly one mode is selected
113
+ when the client is constructed, and only that mode's credentials are used. The precedence is:
114
+
115
+ 1. An explicit `token` selects personal-token auth and overrides every environment credential.
116
+ 2. Explicit OAuth access-token credentials select OAuth; any missing half may come from the matching `DISCOGS_*`
117
+ variable, but an unrelated environment token never takes over.
118
+ 3. Explicit `consumer_key`/`consumer_secret` select consumer auth, without borrowing environment access tokens.
119
+ 4. With no auth arguments, the environment resolves the mode: `DISCOGS_TOKEN`, then a complete OAuth set, then
120
+ `DISCOGS_CONSUMER_KEY`/`DISCOGS_CONSUMER_SECRET`, then unauthenticated.
121
+
122
+ An explicitly selected but incomplete credential set raises `ValueError` rather than quietly falling back to a
123
+ different account or mode. See [`examples/authentication.py`](examples/authentication.py) for the full OAuth flow.
110
124
 
111
125
  > [!TIP]
112
126
  > Use a `.env` file with [python-dotenv](https://pypi.org/project/python-dotenv/) or
113
127
  > [direnv](https://direnv.net/) to avoid exporting tokens manually in every shell.
114
128
 
115
129
  > [!NOTE]
116
- > Discogs enforces a 60 requests/minute rate limit. The SDK handles this automatically
117
- > with exponential backoff and `Retry-After` support — no manual throttling needed.
130
+ > Discogs allows 60 requests/minute authenticated and 25/minute unauthenticated, measured as a moving average over
131
+ > the last 60 seconds. The SDK does not pace your requests: it retries a rate-limited **read** a bounded number of
132
+ > times (`max_retries`, default 3), honouring `Retry-After`. Sustained traffic above the limit still needs pacing on
133
+ > your side, and you can still receive `RateLimitError` once the retries are exhausted.
134
+
135
+ > [!WARNING]
136
+ > Mutations are not replayed. A `POST`, `PUT` or `DELETE` is retried only when the failure proves the request never
137
+ > reached the server, such as a refused connection. After a read timeout or a 5xx the change may already have been
138
+ > committed, so the SDK raises instead of sending it again — the remote outcome is genuinely unknown and only you
139
+ > can decide how to reconcile it.
118
140
 
119
141
  ### Fetching resources
120
142
 
@@ -160,6 +182,7 @@ for v in client.masters.get(3719).versions.list(format="Vinyl", country="US"):
160
182
  import asyncio
161
183
  from discogs_sdk import AsyncDiscogs
162
184
 
185
+
163
186
  async def main():
164
187
  async with AsyncDiscogs() as client: # reads DISCOGS_TOKEN from environment
165
188
  # Must await lazy resources in async mode
@@ -170,6 +193,7 @@ async def main():
170
193
  async for result in client.search(query="Nine Inch Nails"):
171
194
  print(result.title)
172
195
 
196
+
173
197
  asyncio.run(main())
174
198
  ```
175
199
 
@@ -186,20 +210,22 @@ user.collection.folders.create(name="Industrial")
186
210
  for item in user.collection.folders.get(0).releases.list(sort="added"):
187
211
  print(item.basic_information.title)
188
212
 
189
- # Add a release
190
- user.collection.folders.get(1).releases.create(release_id=352665)
213
+ # Add a release. The response identifies the copy you just created, which is
214
+ # how you tell it apart from copies of the same release you already own.
215
+ created = user.collection.folders.get(1).releases.create(release_id=352665)
191
216
 
192
217
  # Deep chaining: folder -> release -> instance -> fields
193
- user.collection.folders.get(1).releases.get(352665).instances.get(
194
- 98765
195
- ).fields.update(field_id=1, value="Signed copy")
218
+ instances = user.collection.folders.get(1).releases.get(352665).instances
219
+ instances.get(created.instance_id).fields.update(field_id=1, value="Signed copy")
196
220
 
197
221
  # Collection value
198
222
  value = user.collection.value.get()
199
223
  print(f"Median: {value.median}, Maximum: {value.maximum}")
200
224
 
201
- # Wantlist
202
- user.wantlist.create(release_id=352665, notes="Original pressing", rating=4)
225
+ # Wantlist — the add takes only the release id; Discogs drops notes and ratings
226
+ # sent to it, so they go in the update call
227
+ user.wantlist.create(release_id=352665)
228
+ user.wantlist.update(352665, notes="Original pressing", rating=4)
203
229
  for want in user.wantlist.list():
204
230
  print(want.basic_information.title)
205
231
  ```
@@ -210,7 +236,9 @@ for want in user.wantlist.list():
210
236
  # Listings
211
237
  listing = client.marketplace.listings.get(123456789)
212
238
  new = client.marketplace.listings.create(
213
- release_id=352665, condition="Very Good Plus (VG+)", price=25.00,
239
+ release_id=352665,
240
+ condition="Very Good Plus (VG+)",
241
+ price=25.00,
214
242
  )
215
243
  client.marketplace.listings.update(new.id, price=22.50)
216
244
  client.marketplace.listings.delete(new.id)
@@ -276,12 +304,36 @@ The [`examples/`](examples/) directory has runnable scripts for every feature:
276
304
  | `cache` | `False` | Enable response caching, or pass a custom `ResponseCache` instance |
277
305
  | `consumer_key` | `None` | OAuth consumer key |
278
306
  | `consumer_secret` | `None` | OAuth consumer secret |
279
- | `http_client` | `None` | Custom `httpx.Client` or `httpx.AsyncClient` |
280
- | `max_retries` | `3` | Max retries on 429/5xx/connection errors |
307
+ | `http_client` | `None` | Custom `httpx2.Client` or `httpx2.AsyncClient` |
308
+ | `max_retries` | `3` | Max retries; reads retry on 429/5xx, network errors and timeouts, mutations only on pre-send failures |
281
309
  | `timeout` | `30.0` | Request timeout in seconds |
282
310
  | `token` | `None` | Personal access token |
283
311
 
284
- Credentials are resolved in order: constructor args > environment variables.
312
+ See [Authentication](#authentication) for how a credential mode is selected.
313
+
314
+ ### Caching
315
+
316
+ Only successful `GET`/`HEAD` responses are cached. Entries are keyed by method, fully resolved URL, the effective
317
+ `Accept` representation, and a non-reversible digest of the selected mode's credentials, so two clients sharing one
318
+ cache — or one SQLite directory — never serve each other's private responses, and unauthenticated traffic gets its
319
+ own namespace. No token or secret is stored in a key.
320
+
321
+ `client.no_cache()` bypasses the cache for the current execution context. Scopes nest, the previous state is
322
+ restored even when the block raises, and concurrent tasks or threads each carry their own state:
323
+
324
+ ```python
325
+ with client.no_cache():
326
+ fresh = client.releases.get(352665).title # always hits the API
327
+ ```
328
+
329
+ ### Custom HTTP clients
330
+
331
+ An injected `http_client` must be an `httpx2` client — the SDK is built on [httpx2](https://github.com/pydantic/httpx2),
332
+ Pydantic's maintained continuation of httpx. It owns its transport configuration and its lifecycle: `client.close()`
333
+ never closes it. SDK credentials, User-Agent and media type are still applied per request, so they describe the request
334
+ without mutating your client's defaults, and its own `httpx2.Auth` cannot replace credentials you gave the SDK. When the
335
+ SDK has no credentials of its own, your client's authentication is preserved and its responses are not cached, because
336
+ the SDK cannot tell whose account they belong to.
285
337
 
286
338
  ## Field naming
287
339
 
@@ -290,7 +342,7 @@ Model fields use clean Python names. Where the Discogs API uses inconsistent or
290
342
  | API field | Python attribute | Models |
291
343
  |---|---|---|
292
344
  | `anv` | `name_variation` | `ArtistCredit` |
293
- | `catno` | `catalog_number` | `LabelCredit`, `Company`, `LabelRelease`, `SearchResult` |
345
+ | `catno` | `catalog_number` | `LabelCredit`, `Company`, `LabelRelease`, `MasterVersion`, `SearchResult` |
294
346
  | `created_ts` | `created_at` | `Export`, `Upload`, `List_` |
295
347
  | `curr_abbr` | `currency_code` | `OriginalPrice`, `User` |
296
348
  | `curr_id` | `currency_id` | `OriginalPrice` |
@@ -307,7 +359,7 @@ Both names work as attributes, so you can use whichever you prefer:
307
359
  ```python
308
360
  release = client.releases.get(352665) # The Downward Spiral
309
361
  print(release.extra_artists) # Python name
310
- print(release.extraartists) # API name — same value
362
+ print(release.extraartists) # API name — same value
311
363
  ```
312
364
 
313
365
  ## Contributing
@@ -8,7 +8,7 @@
8
8
  <a href="https://github.com/jmfontaine/discogs-sdk/blob/main/LICENSE.txt"><img src="https://img.shields.io/pypi/l/discogs-sdk.svg" alt="License"></a>
9
9
  </p>
10
10
 
11
- discogs-sdk is a modern Python client for the [Discogs API](https://www.discogs.com/developers) with full endpoint coverage, a fluent chainable syntax, and built-in response caching.
11
+ discogs-sdk is a modern Python client for the [Discogs API](https://www.discogs.com/developers) covering every documented v2 endpoint, with a fluent chainable syntax and built-in response caching.
12
12
 
13
13
  ```python
14
14
  from discogs_sdk import Discogs
@@ -33,11 +33,11 @@ Requires Python 3.10+.
33
33
 
34
34
  ## Features
35
35
 
36
- - **Full API Coverage** — Every endpoint in the Discogs API v2
36
+ - **Complete Endpoint Coverage** — Every route in the Discogs API v2 documentation
37
37
  - **Fluent API** — Chain sub-resources naturally: `client.releases.get(id).rating.get()`
38
38
  - **Lazy Loading** — No HTTP calls until you actually need the data
39
39
  - **Effortless Pagination** — Browse results without managing pages or offsets
40
- - **Rate Limit Friendly** — Automatically stay within API limits
40
+ - **Rate Limit Aware** — Bounded retries with `Retry-After` support
41
41
  - **Built-in Caching** — Optional TTL-based caching reduces API calls
42
42
  - **Flexible Auth** — Supports personal tokens, consumer key/secret, or full OAuth 1.0a
43
43
  - **Type Safe** — Get autocomplete and IDE support
@@ -45,17 +45,18 @@ Requires Python 3.10+.
45
45
 
46
46
  ### How it compares
47
47
 
48
+ The established alternative is [python3-discogs-client](https://github.com/joalla/discogs_client). Both load data
49
+ lazily, paginate automatically, support OAuth 1.0a and back off on HTTP 429, so the differences that matter are:
50
+
48
51
  | | discogs-sdk | python3-discogs-client |
49
52
  |---|---|---|
50
- | Full API coverage | ✓ | Partial |
51
- | Fluent sub-resource chaining | ✓ | ✗ |
52
- | Lazy loading | ✓ | ✗ |
53
- | Auto-pagination | ✓ | ✓ |
54
- | Automatic rate limit handling | ✓ | ✗ |
55
- | Caching | ✓ | ✗ |
56
- | OAuth 1.0a | ✓ | ✓ |
57
- | Type safe (Pydantic models) | ✓ | ✗ |
58
- | Async & sync | ✓ | ✗ |
53
+ | Documented v2 API coverage | Complete | Partial † |
54
+ | Sync and async | Both | Sync only |
55
+ | Responses | Typed Pydantic models | Untyped attributes |
56
+ | Response cache | In-memory or SQLite | None |
57
+
58
+ † No inventory export or upload, release ratings or have/want stats, collection fields, folder creation,
59
+ contributions or submissions.
59
60
 
60
61
  ## Quick start
61
62
 
@@ -79,15 +80,34 @@ You can also pass credentials explicitly:
79
80
  client = Discogs(token="your-token-here")
80
81
  ```
81
82
 
82
- The SDK supports three auth modes: personal token, consumer key/secret, and OAuth 1.0a. Credentials passed to the constructor take precedence over environment variables (`DISCOGS_TOKEN`, `DISCOGS_CONSUMER_KEY`, etc.). See [`examples/authentication.py`](examples/authentication.py) for the full OAuth flow.
83
+ The SDK supports three auth modes: personal token, consumer key/secret, and OAuth 1.0a. Exactly one mode is selected
84
+ when the client is constructed, and only that mode's credentials are used. The precedence is:
85
+
86
+ 1. An explicit `token` selects personal-token auth and overrides every environment credential.
87
+ 2. Explicit OAuth access-token credentials select OAuth; any missing half may come from the matching `DISCOGS_*`
88
+ variable, but an unrelated environment token never takes over.
89
+ 3. Explicit `consumer_key`/`consumer_secret` select consumer auth, without borrowing environment access tokens.
90
+ 4. With no auth arguments, the environment resolves the mode: `DISCOGS_TOKEN`, then a complete OAuth set, then
91
+ `DISCOGS_CONSUMER_KEY`/`DISCOGS_CONSUMER_SECRET`, then unauthenticated.
92
+
93
+ An explicitly selected but incomplete credential set raises `ValueError` rather than quietly falling back to a
94
+ different account or mode. See [`examples/authentication.py`](examples/authentication.py) for the full OAuth flow.
83
95
 
84
96
  > [!TIP]
85
97
  > Use a `.env` file with [python-dotenv](https://pypi.org/project/python-dotenv/) or
86
98
  > [direnv](https://direnv.net/) to avoid exporting tokens manually in every shell.
87
99
 
88
100
  > [!NOTE]
89
- > Discogs enforces a 60 requests/minute rate limit. The SDK handles this automatically
90
- > with exponential backoff and `Retry-After` support — no manual throttling needed.
101
+ > Discogs allows 60 requests/minute authenticated and 25/minute unauthenticated, measured as a moving average over
102
+ > the last 60 seconds. The SDK does not pace your requests: it retries a rate-limited **read** a bounded number of
103
+ > times (`max_retries`, default 3), honouring `Retry-After`. Sustained traffic above the limit still needs pacing on
104
+ > your side, and you can still receive `RateLimitError` once the retries are exhausted.
105
+
106
+ > [!WARNING]
107
+ > Mutations are not replayed. A `POST`, `PUT` or `DELETE` is retried only when the failure proves the request never
108
+ > reached the server, such as a refused connection. After a read timeout or a 5xx the change may already have been
109
+ > committed, so the SDK raises instead of sending it again — the remote outcome is genuinely unknown and only you
110
+ > can decide how to reconcile it.
91
111
 
92
112
  ### Fetching resources
93
113
 
@@ -133,6 +153,7 @@ for v in client.masters.get(3719).versions.list(format="Vinyl", country="US"):
133
153
  import asyncio
134
154
  from discogs_sdk import AsyncDiscogs
135
155
 
156
+
136
157
  async def main():
137
158
  async with AsyncDiscogs() as client: # reads DISCOGS_TOKEN from environment
138
159
  # Must await lazy resources in async mode
@@ -143,6 +164,7 @@ async def main():
143
164
  async for result in client.search(query="Nine Inch Nails"):
144
165
  print(result.title)
145
166
 
167
+
146
168
  asyncio.run(main())
147
169
  ```
148
170
 
@@ -159,20 +181,22 @@ user.collection.folders.create(name="Industrial")
159
181
  for item in user.collection.folders.get(0).releases.list(sort="added"):
160
182
  print(item.basic_information.title)
161
183
 
162
- # Add a release
163
- user.collection.folders.get(1).releases.create(release_id=352665)
184
+ # Add a release. The response identifies the copy you just created, which is
185
+ # how you tell it apart from copies of the same release you already own.
186
+ created = user.collection.folders.get(1).releases.create(release_id=352665)
164
187
 
165
188
  # Deep chaining: folder -> release -> instance -> fields
166
- user.collection.folders.get(1).releases.get(352665).instances.get(
167
- 98765
168
- ).fields.update(field_id=1, value="Signed copy")
189
+ instances = user.collection.folders.get(1).releases.get(352665).instances
190
+ instances.get(created.instance_id).fields.update(field_id=1, value="Signed copy")
169
191
 
170
192
  # Collection value
171
193
  value = user.collection.value.get()
172
194
  print(f"Median: {value.median}, Maximum: {value.maximum}")
173
195
 
174
- # Wantlist
175
- user.wantlist.create(release_id=352665, notes="Original pressing", rating=4)
196
+ # Wantlist — the add takes only the release id; Discogs drops notes and ratings
197
+ # sent to it, so they go in the update call
198
+ user.wantlist.create(release_id=352665)
199
+ user.wantlist.update(352665, notes="Original pressing", rating=4)
176
200
  for want in user.wantlist.list():
177
201
  print(want.basic_information.title)
178
202
  ```
@@ -183,7 +207,9 @@ for want in user.wantlist.list():
183
207
  # Listings
184
208
  listing = client.marketplace.listings.get(123456789)
185
209
  new = client.marketplace.listings.create(
186
- release_id=352665, condition="Very Good Plus (VG+)", price=25.00,
210
+ release_id=352665,
211
+ condition="Very Good Plus (VG+)",
212
+ price=25.00,
187
213
  )
188
214
  client.marketplace.listings.update(new.id, price=22.50)
189
215
  client.marketplace.listings.delete(new.id)
@@ -249,12 +275,36 @@ The [`examples/`](examples/) directory has runnable scripts for every feature:
249
275
  | `cache` | `False` | Enable response caching, or pass a custom `ResponseCache` instance |
250
276
  | `consumer_key` | `None` | OAuth consumer key |
251
277
  | `consumer_secret` | `None` | OAuth consumer secret |
252
- | `http_client` | `None` | Custom `httpx.Client` or `httpx.AsyncClient` |
253
- | `max_retries` | `3` | Max retries on 429/5xx/connection errors |
278
+ | `http_client` | `None` | Custom `httpx2.Client` or `httpx2.AsyncClient` |
279
+ | `max_retries` | `3` | Max retries; reads retry on 429/5xx, network errors and timeouts, mutations only on pre-send failures |
254
280
  | `timeout` | `30.0` | Request timeout in seconds |
255
281
  | `token` | `None` | Personal access token |
256
282
 
257
- Credentials are resolved in order: constructor args > environment variables.
283
+ See [Authentication](#authentication) for how a credential mode is selected.
284
+
285
+ ### Caching
286
+
287
+ Only successful `GET`/`HEAD` responses are cached. Entries are keyed by method, fully resolved URL, the effective
288
+ `Accept` representation, and a non-reversible digest of the selected mode's credentials, so two clients sharing one
289
+ cache — or one SQLite directory — never serve each other's private responses, and unauthenticated traffic gets its
290
+ own namespace. No token or secret is stored in a key.
291
+
292
+ `client.no_cache()` bypasses the cache for the current execution context. Scopes nest, the previous state is
293
+ restored even when the block raises, and concurrent tasks or threads each carry their own state:
294
+
295
+ ```python
296
+ with client.no_cache():
297
+ fresh = client.releases.get(352665).title # always hits the API
298
+ ```
299
+
300
+ ### Custom HTTP clients
301
+
302
+ An injected `http_client` must be an `httpx2` client — the SDK is built on [httpx2](https://github.com/pydantic/httpx2),
303
+ Pydantic's maintained continuation of httpx. It owns its transport configuration and its lifecycle: `client.close()`
304
+ never closes it. SDK credentials, User-Agent and media type are still applied per request, so they describe the request
305
+ without mutating your client's defaults, and its own `httpx2.Auth` cannot replace credentials you gave the SDK. When the
306
+ SDK has no credentials of its own, your client's authentication is preserved and its responses are not cached, because
307
+ the SDK cannot tell whose account they belong to.
258
308
 
259
309
  ## Field naming
260
310
 
@@ -263,7 +313,7 @@ Model fields use clean Python names. Where the Discogs API uses inconsistent or
263
313
  | API field | Python attribute | Models |
264
314
  |---|---|---|
265
315
  | `anv` | `name_variation` | `ArtistCredit` |
266
- | `catno` | `catalog_number` | `LabelCredit`, `Company`, `LabelRelease`, `SearchResult` |
316
+ | `catno` | `catalog_number` | `LabelCredit`, `Company`, `LabelRelease`, `MasterVersion`, `SearchResult` |
267
317
  | `created_ts` | `created_at` | `Export`, `Upload`, `List_` |
268
318
  | `curr_abbr` | `currency_code` | `OriginalPrice`, `User` |
269
319
  | `curr_id` | `currency_id` | `OriginalPrice` |
@@ -280,7 +330,7 @@ Both names work as attributes, so you can use whichever you prefer:
280
330
  ```python
281
331
  release = client.releases.get(352665) # The Downward Spiral
282
332
  print(release.extra_artists) # Python name
283
- print(release.extraartists) # API name — same value
333
+ print(release.extraartists) # API name — same value
284
334
  ```
285
335
 
286
336
  ## Contributing