python3-discogs-client 2.5__py3-none-any.whl → 2.7__py3-none-any.whl
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.
- discogs_client/__init__.py +1 -1
- discogs_client/client.py +26 -0
- discogs_client/fetchers.py +8 -3
- discogs_client/models.py +4 -1
- {python3_discogs_client-2.5.dist-info → python3_discogs_client-2.7.dist-info}/METADATA +1 -1
- python3_discogs_client-2.7.dist-info/RECORD +11 -0
- {python3_discogs_client-2.5.dist-info → python3_discogs_client-2.7.dist-info}/WHEEL +1 -1
- python3_discogs_client-2.5.dist-info/RECORD +0 -11
- {python3_discogs_client-2.5.dist-info → python3_discogs_client-2.7.dist-info}/LICENSE +0 -0
- {python3_discogs_client-2.5.dist-info → python3_discogs_client-2.7.dist-info}/top_level.txt +0 -0
discogs_client/__init__.py
CHANGED
discogs_client/client.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
+
from typing import Union
|
|
2
3
|
from urllib.parse import urlencode
|
|
3
4
|
|
|
4
5
|
from discogs_client import models
|
|
@@ -193,3 +194,28 @@ class Client:
|
|
|
193
194
|
if not isinstance(value, bool):
|
|
194
195
|
raise ValueError("Backoff enabled toggle should be of type bool")
|
|
195
196
|
self._fetcher.backoff_enabled = value
|
|
197
|
+
|
|
198
|
+
@property
|
|
199
|
+
def connection_timeout(self):
|
|
200
|
+
"""Return current client connection timeout"""
|
|
201
|
+
return self._fetcher.connect_timeout
|
|
202
|
+
|
|
203
|
+
@property
|
|
204
|
+
def read_timeout(self):
|
|
205
|
+
"""Return current client read timeout"""
|
|
206
|
+
return self._fetcher.read_timeout
|
|
207
|
+
|
|
208
|
+
def set_timeout(self,
|
|
209
|
+
connect: Union[int, float] = 5,
|
|
210
|
+
read: Union[int, float] = 10) -> None:
|
|
211
|
+
"""Set request timeout parameters
|
|
212
|
+
|
|
213
|
+
Parameters
|
|
214
|
+
----------
|
|
215
|
+
connect : (Union[int, float], optional)
|
|
216
|
+
Time in seconds after which connect will timeout. Defaults to 5.
|
|
217
|
+
read : (Union[int, float], optional)
|
|
218
|
+
Time in seconds after which request will timeout. Defaults to 10.
|
|
219
|
+
"""
|
|
220
|
+
self._fetcher.connect_timeout = connect
|
|
221
|
+
self._fetcher.read_timeout = read
|
discogs_client/fetchers.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import requests
|
|
2
1
|
from requests.api import request
|
|
3
2
|
from oauthlib import oauth1
|
|
4
3
|
import json
|
|
@@ -6,6 +5,7 @@ import os
|
|
|
6
5
|
import re
|
|
7
6
|
from discogs_client.utils import backoff
|
|
8
7
|
from urllib.parse import parse_qsl
|
|
8
|
+
from typing import Union
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Fetcher:
|
|
@@ -16,6 +16,8 @@ class Fetcher:
|
|
|
16
16
|
(It's a slightly leaky abstraction designed to make testing easier.)
|
|
17
17
|
"""
|
|
18
18
|
backoff_enabled = True
|
|
19
|
+
connect_timeout: Union[float, int, None] = None
|
|
20
|
+
read_timeout: Union[float, int, None] = None
|
|
19
21
|
|
|
20
22
|
def fetch(self, client, method, url, data=None, headers=None, json=True):
|
|
21
23
|
"""Fetch the given request
|
|
@@ -52,8 +54,11 @@ class Fetcher:
|
|
|
52
54
|
|
|
53
55
|
@backoff
|
|
54
56
|
def request(self, method, url, data, headers, params=None):
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
return request(
|
|
58
|
+
method=method, url=url, data=data,
|
|
59
|
+
headers=headers, params=params,
|
|
60
|
+
timeout=(self.connect_timeout, self.read_timeout)
|
|
61
|
+
)
|
|
57
62
|
|
|
58
63
|
|
|
59
64
|
class LoggingDelegator:
|
discogs_client/models.py
CHANGED
|
@@ -478,7 +478,10 @@ class Artist(PrimaryAPIObject):
|
|
|
478
478
|
#: single string, for example: "DJ ABC Feat MC Z". Also check out the
|
|
479
479
|
#: ``artists_sort`` attribute of a ``Release`` object.
|
|
480
480
|
join = SimpleField()
|
|
481
|
-
|
|
481
|
+
#: This attribute is only present when an ``Artist`` object is part of a
|
|
482
|
+
#: ``credits`` list of a ``Release`` object.
|
|
483
|
+
role = SimpleField()
|
|
484
|
+
|
|
482
485
|
def __init__(self, client, dict_):
|
|
483
486
|
super(Artist, self).__init__(client, dict_)
|
|
484
487
|
self.data['resource_url'] = '{0}/artists/{1}'.format(client._base_url, dict_['id'])
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
discogs_client/__init__.py,sha256=jtFqxDk4H8_GK_bF6p_1dcoKVt_Di_GYo5uWB2ESPfc,445
|
|
2
|
+
discogs_client/client.py,sha256=AqQmwJd54DrAFTnTb4zi1jCefjC6sbISh43FZuYsQ0g,7632
|
|
3
|
+
discogs_client/exceptions.py,sha256=7kHj2wbpfT0gLE7uqm6c4aS28Wkr58f6u9jfpcT_NSM,1323
|
|
4
|
+
discogs_client/fetchers.py,sha256=UP-FcCo8MOgfG5VpiFCRpKUUBcVn_zSMbnV5Z3DpAqQ,11963
|
|
5
|
+
discogs_client/models.py,sha256=c6OfCIEPW7HtOpegP3tcdGPtEBTm7adDxWyQzcfe52M,31844
|
|
6
|
+
discogs_client/utils.py,sha256=KJDkJ91C1rVW7Tr4hZ8To-sJyKtFu4gT1oNQIv7Mo_k,3395
|
|
7
|
+
python3_discogs_client-2.7.dist-info/LICENSE,sha256=GvYq7dzLVxNCGN29xn0Ec1JMpzZwPXzOAdtZsuB9pUI,1455
|
|
8
|
+
python3_discogs_client-2.7.dist-info/METADATA,sha256=sOt6aDkRndWOtM0ujuMspeX2EdJfHGysOfOIU6QQ5U8,927
|
|
9
|
+
python3_discogs_client-2.7.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
10
|
+
python3_discogs_client-2.7.dist-info/top_level.txt,sha256=jgqsRXqG3dJuCOSykXhXN68DMNu77XYQuqgqlPSSv1E,15
|
|
11
|
+
python3_discogs_client-2.7.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
discogs_client/__init__.py,sha256=gpVKLPuCH-pX0n0qiccnQw5BdNNvgBTmIoH6g8RrZoQ,445
|
|
2
|
-
discogs_client/client.py,sha256=nP74dSqOt3QwnMX9VhsfC7jGYePHJy632n27jpTGj2w,6739
|
|
3
|
-
discogs_client/exceptions.py,sha256=7kHj2wbpfT0gLE7uqm6c4aS28Wkr58f6u9jfpcT_NSM,1323
|
|
4
|
-
discogs_client/fetchers.py,sha256=DagYw0uh9jAw1woT_WYyP4fAGV5jQUVQ284c2qImdzA,11784
|
|
5
|
-
discogs_client/models.py,sha256=jtKrrz_5VyoeuGgbIy0YOY_YTATeK8prt2affrXrGBM,31689
|
|
6
|
-
discogs_client/utils.py,sha256=KJDkJ91C1rVW7Tr4hZ8To-sJyKtFu4gT1oNQIv7Mo_k,3395
|
|
7
|
-
python3_discogs_client-2.5.dist-info/LICENSE,sha256=GvYq7dzLVxNCGN29xn0Ec1JMpzZwPXzOAdtZsuB9pUI,1455
|
|
8
|
-
python3_discogs_client-2.5.dist-info/METADATA,sha256=hrUUQ-cLuBnV5m_03vxlgnkX3wnOiVkEJutCtjf1eGQ,927
|
|
9
|
-
python3_discogs_client-2.5.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
10
|
-
python3_discogs_client-2.5.dist-info/top_level.txt,sha256=jgqsRXqG3dJuCOSykXhXN68DMNu77XYQuqgqlPSSv1E,15
|
|
11
|
-
python3_discogs_client-2.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|