python-epo-ops-client 4.2.0__py3-none-any.whl → 4.2.1__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.
- epo_ops/api.py +5 -4
- epo_ops/models.py +8 -12
- {python_epo_ops_client-4.2.0.dist-info → python_epo_ops_client-4.2.1.dist-info}/METADATA +2 -2
- {python_epo_ops_client-4.2.0.dist-info → python_epo_ops_client-4.2.1.dist-info}/RECORD +7 -7
- {python_epo_ops_client-4.2.0.dist-info → python_epo_ops_client-4.2.1.dist-info}/WHEEL +0 -0
- {python_epo_ops_client-4.2.0.dist-info → python_epo_ops_client-4.2.1.dist-info}/licenses/LICENSE +0 -0
- {python_epo_ops_client-4.2.0.dist-info → python_epo_ops_client-4.2.1.dist-info}/top_level.txt +0 -0
epo_ops/api.py
CHANGED
|
@@ -11,7 +11,6 @@ from requests.exceptions import HTTPError
|
|
|
11
11
|
from . import exceptions
|
|
12
12
|
from .middlewares import Throttler
|
|
13
13
|
from .models import (
|
|
14
|
-
NETWORK_TIMEOUT,
|
|
15
14
|
AccessToken,
|
|
16
15
|
Docdb,
|
|
17
16
|
Epodoc,
|
|
@@ -21,6 +20,7 @@ from .models import (
|
|
|
21
20
|
|
|
22
21
|
log = logging.getLogger(__name__)
|
|
23
22
|
|
|
23
|
+
DEFAULT_NETWORK_TIMEOUT = 10.0
|
|
24
24
|
|
|
25
25
|
class Client(object):
|
|
26
26
|
__auth_url__ = "https://ops.epo.org/3.2/auth/accesstoken"
|
|
@@ -35,14 +35,15 @@ class Client(object):
|
|
|
35
35
|
__register_path__ = "register"
|
|
36
36
|
__register_search_path__ = "register/search"
|
|
37
37
|
|
|
38
|
-
def __init__(self, key, secret, accept_type="xml", middlewares=None):
|
|
38
|
+
def __init__(self, key, secret, accept_type="xml", middlewares=None, timeout=DEFAULT_NETWORK_TIMEOUT):
|
|
39
39
|
self.accept_type = "application/{0}".format(accept_type)
|
|
40
40
|
self.middlewares = middlewares
|
|
41
41
|
if middlewares is None:
|
|
42
42
|
self.middlewares = [Throttler()]
|
|
43
|
-
self.request = Request(self.middlewares)
|
|
43
|
+
self.request = Request(self.middlewares, timeout)
|
|
44
44
|
self.key = key
|
|
45
45
|
self.secret = secret
|
|
46
|
+
self.timeout = timeout
|
|
46
47
|
self._access_token = None
|
|
47
48
|
|
|
48
49
|
def family(
|
|
@@ -351,7 +352,7 @@ class Client(object):
|
|
|
351
352
|
self.__auth_url__,
|
|
352
353
|
headers=headers,
|
|
353
354
|
data=payload,
|
|
354
|
-
timeout=
|
|
355
|
+
timeout=self.timeout,
|
|
355
356
|
)
|
|
356
357
|
response.raise_for_status()
|
|
357
358
|
self._access_token = AccessToken(response)
|
epo_ops/models.py
CHANGED
|
@@ -10,10 +10,6 @@ from .utils import quote, validate_date
|
|
|
10
10
|
|
|
11
11
|
log = logging.getLogger(__name__)
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
NETWORK_TIMEOUT = 10.0
|
|
15
|
-
|
|
16
|
-
|
|
17
13
|
def _prepare_part(part):
|
|
18
14
|
return "({0})".format(quote(part))
|
|
19
15
|
|
|
@@ -68,8 +64,9 @@ class AccessToken(object):
|
|
|
68
64
|
|
|
69
65
|
|
|
70
66
|
class Request(object):
|
|
71
|
-
def __init__(self, middlewares):
|
|
67
|
+
def __init__(self, middlewares, timeout=None):
|
|
72
68
|
self.middlewares = middlewares
|
|
69
|
+
self.timeout = timeout
|
|
73
70
|
self.reset_env()
|
|
74
71
|
|
|
75
72
|
@property
|
|
@@ -86,10 +83,10 @@ class Request(object):
|
|
|
86
83
|
self.env.update(self.default_env)
|
|
87
84
|
|
|
88
85
|
def post(self, url, data=None, **kwargs):
|
|
89
|
-
return self._request(_post_callback, url, data, **kwargs)
|
|
86
|
+
return self._request(self._post_callback, url, data, **kwargs)
|
|
90
87
|
|
|
91
88
|
def get(self, url, data=None, **kwargs):
|
|
92
|
-
return self._request(_get_callback, url, data, **kwargs)
|
|
89
|
+
return self._request(self._get_callback, url, data, **kwargs)
|
|
93
90
|
|
|
94
91
|
def _request(self, callback, url, data=None, **kwargs):
|
|
95
92
|
self.reset_env()
|
|
@@ -111,9 +108,8 @@ class Request(object):
|
|
|
111
108
|
return response
|
|
112
109
|
|
|
113
110
|
|
|
114
|
-
def _post_callback(url, data, **kwargs):
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
def _post_callback(self, url, data, **kwargs):
|
|
112
|
+
return requests.post(url, data, **kwargs, timeout=self.timeout)
|
|
117
113
|
|
|
118
|
-
def _get_callback(url, data, **kwargs):
|
|
119
|
-
|
|
114
|
+
def _get_callback(self, url, data, **kwargs):
|
|
115
|
+
return requests.get(url, **kwargs, timeout=self.timeout)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-epo-ops-client
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.1
|
|
4
4
|
Summary: Python client for EPO OPS, the European Patent Office's Open Patent Services API.
|
|
5
5
|
Home-page: https://github.com/ip-tools/python-epo-ops-client
|
|
6
6
|
Download-URL: https://pypi.org/project/python-epo-ops-client/#files
|
|
@@ -38,7 +38,7 @@ Requires-Dist: wheel<1; extra == "develop"
|
|
|
38
38
|
Provides-Extra: test
|
|
39
39
|
Requires-Dist: pytest<9; extra == "test"
|
|
40
40
|
Requires-Dist: pytest-cache<2; extra == "test"
|
|
41
|
-
Requires-Dist: pytest-cov<
|
|
41
|
+
Requires-Dist: pytest-cov<7.1; extra == "test"
|
|
42
42
|
Requires-Dist: python-dotenv<1.2; extra == "test"
|
|
43
43
|
Requires-Dist: responses<0.26; extra == "test"
|
|
44
44
|
Dynamic: author
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
epo_ops/__init__.py,sha256=FBeuePcy1kzPa9r8eVbJKuCTH7KraksI9RxpBcOqWXc,571
|
|
2
2
|
epo_ops/__version__.py,sha256=oPE9VFlJQnVOEwuJbON4aK7XhyF3CB86MEnkbhJ0NTU,204
|
|
3
|
-
epo_ops/api.py,sha256=
|
|
3
|
+
epo_ops/api.py,sha256=oQBpGF5xqRky66m3dI1enSEmml5eukRClM5HnrFqksw,16701
|
|
4
4
|
epo_ops/exceptions.py,sha256=MYaRMNHBH1REggRn0Lmp8_acnHbFb9uq51HFS-qz6c4,620
|
|
5
|
-
epo_ops/models.py,sha256=
|
|
5
|
+
epo_ops/models.py,sha256=caxvikwNiESMgezQudR2l6qFTuB0Mat9_CT00d-qo6w,3441
|
|
6
6
|
epo_ops/utils.py,sha256=mGy57QUSgpQG21_nbHEj6ZMqoxeAK8TbFwohfGDB6xw,776
|
|
7
7
|
epo_ops/middlewares/__init__.py,sha256=y6MT9llD5jdVduGHUghGr1tgssvoJ75-0L4WlFPe3pw,178
|
|
8
8
|
epo_ops/middlewares/middleware.py,sha256=kXo58_kju4IlM7vTAVwmn2Ynk5O-ZIdoWw2slonT_nY,518
|
|
@@ -16,8 +16,8 @@ epo_ops/middlewares/throttle/utils.py,sha256=DezWXXGJw9GoNk4lPtHVKQ0FZXJo98jgCzv
|
|
|
16
16
|
epo_ops/middlewares/throttle/storages/__init__.py,sha256=VtpaDmfxeQM2-tc9tad5-_DTFYp4n-Ec4QPPi6niglw,81
|
|
17
17
|
epo_ops/middlewares/throttle/storages/sqlite.py,sha256=frYBYpDyay4pTfGrVatqZVsIBATlvGqo-4zZJFddSO4,4934
|
|
18
18
|
epo_ops/middlewares/throttle/storages/storage.py,sha256=FLJ0kvUSDaI_fiHuXbT3UVNRmXcAPS5M2v3vYEYBgQY,757
|
|
19
|
-
python_epo_ops_client-4.2.
|
|
20
|
-
python_epo_ops_client-4.2.
|
|
21
|
-
python_epo_ops_client-4.2.
|
|
22
|
-
python_epo_ops_client-4.2.
|
|
23
|
-
python_epo_ops_client-4.2.
|
|
19
|
+
python_epo_ops_client-4.2.1.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
|
20
|
+
python_epo_ops_client-4.2.1.dist-info/METADATA,sha256=qUHXKox8GVYAGhGfoF42d4SD4wwk-FdVsOO7HE4V9MM,10419
|
|
21
|
+
python_epo_ops_client-4.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
22
|
+
python_epo_ops_client-4.2.1.dist-info/top_level.txt,sha256=0e54UaEWTAp3B6Xh_hZvJnuTK3iB0xtm57WxsW8xJkI,8
|
|
23
|
+
python_epo_ops_client-4.2.1.dist-info/RECORD,,
|
|
File without changes
|
{python_epo_ops_client-4.2.0.dist-info → python_epo_ops_client-4.2.1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{python_epo_ops_client-4.2.0.dist-info → python_epo_ops_client-4.2.1.dist-info}/top_level.txt
RENAMED
|
File without changes
|