commonpy 1.13.0__tar.gz → 1.13.2__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.
- {commonpy-1.13.0 → commonpy-1.13.2}/PKG-INFO +37 -12
- {commonpy-1.13.0 → commonpy-1.13.2}/README.md +17 -8
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/__init__.py +1 -1
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy.egg-info/PKG-INFO +37 -12
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy.egg-info/requires.txt +2 -2
- {commonpy-1.13.0 → commonpy-1.13.2}/setup.cfg +3 -3
- {commonpy-1.13.0 → commonpy-1.13.2}/LICENSE +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/data_structures.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/data_utils.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/exceptions.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/file_utils.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/interrupt.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/module_utils.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/network_utils.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/string_utils.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/system_utils.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy.egg-info/SOURCES.txt +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy.egg-info/dependency_links.txt +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy.egg-info/not-zip-safe +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/commonpy.egg-info/top_level.txt +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/setup.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_data_structures.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_data_utils.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_exceptions.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_file_utils.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_module_utils.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_network_utils.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_string_utils.py +0 -0
- {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: commonpy
|
|
3
|
-
Version: 1.13.
|
|
3
|
+
Version: 1.13.2
|
|
4
4
|
Summary: Assortment of Python helper functions and utility classes
|
|
5
5
|
Home-page: https://github.com/caltechlibrary/commonpy
|
|
6
6
|
Author: Michael Hucka
|
|
@@ -18,10 +18,26 @@ Classifier: Operating System :: POSIX
|
|
|
18
18
|
Classifier: Operating System :: POSIX :: Linux
|
|
19
19
|
Classifier: Operating System :: Unix
|
|
20
20
|
Classifier: Programming Language :: Python
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.
|
|
22
|
-
Requires-Python: >=3.
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE
|
|
25
|
+
Requires-Dist: PyYAML>=5.3.1
|
|
26
|
+
Requires-Dist: boltons==21.0.0
|
|
27
|
+
Requires-Dist: dateparser==1.1.8
|
|
28
|
+
Requires-Dist: deprecation==2.1.0
|
|
29
|
+
Requires-Dist: h2>=4.4.1
|
|
30
|
+
Requires-Dist: httpx>=0.28.1
|
|
31
|
+
Requires-Dist: humanize>=3.9.0
|
|
32
|
+
Requires-Dist: python_dateutil==2.8.2
|
|
33
|
+
Requires-Dist: pywin32>=301; sys_platform == "win32"
|
|
34
|
+
Requires-Dist: regex<=2022.3.2
|
|
35
|
+
Requires-Dist: setuptools>=67.5.1
|
|
36
|
+
Requires-Dist: sidetrack>=2.0.0
|
|
37
|
+
Requires-Dist: tldextract==3.0.2
|
|
38
|
+
Requires-Dist: validator-collection==1.5.0
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
Dynamic: requires-dist
|
|
25
41
|
|
|
26
42
|
CommonPy<img width="12%" align="right" src="https://github.com/caltechlibrary/commonpy/raw/main/.graphics/commonpy-icon.png">
|
|
27
43
|
===============================================
|
|
@@ -30,7 +46,7 @@ This is a collection of common utility functions and classes that we at the Calt
|
|
|
30
46
|
|
|
31
47
|
[](https://github.com/caltechlibrary/commonpy/releases)
|
|
32
48
|
[](https://choosealicense.com/licenses/bsd-3-clause)
|
|
33
|
-
[](http://shields.io)
|
|
34
50
|
[](https://pypi.org/project/commonpy/)
|
|
35
51
|
|
|
36
52
|
Table of contents
|
|
@@ -171,28 +187,37 @@ The `network_utils` module provides several functions that are useful when perfo
|
|
|
171
187
|
| `hostname(url)` | Returns the hostname portion of a URL |
|
|
172
188
|
| `net(...)` | See below |
|
|
173
189
|
| `netlock(url)` | Returns the hostname, port number (if any), and login info (if any) |
|
|
190
|
+
| `network(...)` | See below |
|
|
174
191
|
| `network_available()` | Returns `True` if external hosts are reacheable over the network |
|
|
175
192
|
| `on_localhost(url)` | Returns `True` if the address of `url` points to the local host |
|
|
176
193
|
| `scheme(url)` | Returns the protocol portion of the url; e.g., "https" |
|
|
177
194
|
|
|
178
195
|
|
|
179
|
-
#### _`net`_
|
|
196
|
+
#### _`network` and `net`_
|
|
180
197
|
|
|
181
|
-
The `net`
|
|
198
|
+
The `network` and `net` functions in the `network_utils` module implements a fairly high-level network operation interface that internally handles timeouts, rate limits, polling, HTTP/2, and more. The function signatures are identical to this:
|
|
182
199
|
|
|
183
200
|
```python
|
|
184
|
-
|
|
201
|
+
network(method, url, client = None, handle_rate = True, polling = False, **kwargs)
|
|
185
202
|
```
|
|
186
203
|
|
|
187
|
-
The
|
|
204
|
+
The difference between the two functions is their behavior with respect to exceptions. The function `network` returns only a `response` object, and raises an exception if any error occurs. The `net` function returns two values: `response, error` and does not raise exceptions except in the case of bad arguments; instead, any exceptions are returned as the `error` value in the list of return values. This allows the caller to inspect the `response` object even in cases where exceptions are raised.
|
|
188
205
|
|
|
189
|
-
|
|
206
|
+
The `response` object returned by both `net` and `network` is the response from the get or post HTTP call. This object comes from the Python [HTTPX](https://www.python-httpx.org) module used by
|
|
190
207
|
|
|
191
|
-
|
|
208
|
+
The `method` parameter value must be a string chosen from the list of known HTTP methods: `"get"`, `"post"`, `"head"`, `"options"`, `"put"`, `"delete"`, or `"patch"`.
|
|
209
|
+
|
|
210
|
+
The `url` parameter value must be the URL to which the HTTP method will be applied.
|
|
211
|
+
|
|
212
|
+
If keyword `client` is not `None`, it's assumed to be a [HTTPX Client](https://www.python-httpx.org/api/#client) object to use for the network call. Settings such as timeouts should be done by the caller creating appropriately-configured [Client](https://www.python-httpx.org/api/#client) objects.
|
|
213
|
+
|
|
214
|
+
If keyword `handle_rate` is `True`, both functions will automatically pause and retry if it receives an HTTP code 429 ("too many requests") from the server. If `False`, it will return the exception `CommonPy.exceptions.RateLimitExceeded` instead.
|
|
192
215
|
|
|
193
216
|
If keyword `polling` is `True`, certain statuses like 404 are ignored and the response is returned; otherwise, they are considered errors. The behavior when `True` is useful in situations where a URL does not exist until something is ready at the server, and the caller is repeatedly checking the URL. It is up to the caller to implement the polling schedule and call this function (with `polling = True`) as needed.
|
|
194
217
|
|
|
195
|
-
|
|
218
|
+
Additional keyword arguments understood by [HTTPX](https://www.python-httpx.org) can be passed to both `network` and `net`.
|
|
219
|
+
|
|
220
|
+
Both methods always pass the argument `allow_redirects = True` to the underlying Python HTTPX library network calls.
|
|
196
221
|
|
|
197
222
|
|
|
198
223
|
#### _`download` and `download_file`_
|
|
@@ -5,7 +5,7 @@ This is a collection of common utility functions and classes that we at the Calt
|
|
|
5
5
|
|
|
6
6
|
[](https://github.com/caltechlibrary/commonpy/releases)
|
|
7
7
|
[](https://choosealicense.com/licenses/bsd-3-clause)
|
|
8
|
-
[](http://shields.io)
|
|
9
9
|
[](https://pypi.org/project/commonpy/)
|
|
10
10
|
|
|
11
11
|
Table of contents
|
|
@@ -146,28 +146,37 @@ The `network_utils` module provides several functions that are useful when perfo
|
|
|
146
146
|
| `hostname(url)` | Returns the hostname portion of a URL |
|
|
147
147
|
| `net(...)` | See below |
|
|
148
148
|
| `netlock(url)` | Returns the hostname, port number (if any), and login info (if any) |
|
|
149
|
+
| `network(...)` | See below |
|
|
149
150
|
| `network_available()` | Returns `True` if external hosts are reacheable over the network |
|
|
150
151
|
| `on_localhost(url)` | Returns `True` if the address of `url` points to the local host |
|
|
151
152
|
| `scheme(url)` | Returns the protocol portion of the url; e.g., "https" |
|
|
152
153
|
|
|
153
154
|
|
|
154
|
-
#### _`net`_
|
|
155
|
+
#### _`network` and `net`_
|
|
155
156
|
|
|
156
|
-
The `net`
|
|
157
|
+
The `network` and `net` functions in the `network_utils` module implements a fairly high-level network operation interface that internally handles timeouts, rate limits, polling, HTTP/2, and more. The function signatures are identical to this:
|
|
157
158
|
|
|
158
159
|
```python
|
|
159
|
-
|
|
160
|
+
network(method, url, client = None, handle_rate = True, polling = False, **kwargs)
|
|
160
161
|
```
|
|
161
162
|
|
|
162
|
-
The
|
|
163
|
+
The difference between the two functions is their behavior with respect to exceptions. The function `network` returns only a `response` object, and raises an exception if any error occurs. The `net` function returns two values: `response, error` and does not raise exceptions except in the case of bad arguments; instead, any exceptions are returned as the `error` value in the list of return values. This allows the caller to inspect the `response` object even in cases where exceptions are raised.
|
|
163
164
|
|
|
164
|
-
|
|
165
|
+
The `response` object returned by both `net` and `network` is the response from the get or post HTTP call. This object comes from the Python [HTTPX](https://www.python-httpx.org) module used by
|
|
165
166
|
|
|
166
|
-
|
|
167
|
+
The `method` parameter value must be a string chosen from the list of known HTTP methods: `"get"`, `"post"`, `"head"`, `"options"`, `"put"`, `"delete"`, or `"patch"`.
|
|
168
|
+
|
|
169
|
+
The `url` parameter value must be the URL to which the HTTP method will be applied.
|
|
170
|
+
|
|
171
|
+
If keyword `client` is not `None`, it's assumed to be a [HTTPX Client](https://www.python-httpx.org/api/#client) object to use for the network call. Settings such as timeouts should be done by the caller creating appropriately-configured [Client](https://www.python-httpx.org/api/#client) objects.
|
|
172
|
+
|
|
173
|
+
If keyword `handle_rate` is `True`, both functions will automatically pause and retry if it receives an HTTP code 429 ("too many requests") from the server. If `False`, it will return the exception `CommonPy.exceptions.RateLimitExceeded` instead.
|
|
167
174
|
|
|
168
175
|
If keyword `polling` is `True`, certain statuses like 404 are ignored and the response is returned; otherwise, they are considered errors. The behavior when `True` is useful in situations where a URL does not exist until something is ready at the server, and the caller is repeatedly checking the URL. It is up to the caller to implement the polling schedule and call this function (with `polling = True`) as needed.
|
|
169
176
|
|
|
170
|
-
|
|
177
|
+
Additional keyword arguments understood by [HTTPX](https://www.python-httpx.org) can be passed to both `network` and `net`.
|
|
178
|
+
|
|
179
|
+
Both methods always pass the argument `allow_redirects = True` to the underlying Python HTTPX library network calls.
|
|
171
180
|
|
|
172
181
|
|
|
173
182
|
#### _`download` and `download_file`_
|
|
@@ -21,7 +21,7 @@ file "LICENSE" for more information.
|
|
|
21
21
|
# | by the Makefile. Manual changes to these values will be lost. |
|
|
22
22
|
# ╰────────────────────── Notice ── Notice ── Notice ─────────────────────╯
|
|
23
23
|
|
|
24
|
-
__version__ = '1.13.
|
|
24
|
+
__version__ = '1.13.2'
|
|
25
25
|
__description__ = 'Assortment of Python helper functions and utility classes'
|
|
26
26
|
__url__ = 'https://github.com/caltechlibrary/commonpy'
|
|
27
27
|
__author__ = 'Michael Hucka'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: commonpy
|
|
3
|
-
Version: 1.13.
|
|
3
|
+
Version: 1.13.2
|
|
4
4
|
Summary: Assortment of Python helper functions and utility classes
|
|
5
5
|
Home-page: https://github.com/caltechlibrary/commonpy
|
|
6
6
|
Author: Michael Hucka
|
|
@@ -18,10 +18,26 @@ Classifier: Operating System :: POSIX
|
|
|
18
18
|
Classifier: Operating System :: POSIX :: Linux
|
|
19
19
|
Classifier: Operating System :: Unix
|
|
20
20
|
Classifier: Programming Language :: Python
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.
|
|
22
|
-
Requires-Python: >=3.
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE
|
|
25
|
+
Requires-Dist: PyYAML>=5.3.1
|
|
26
|
+
Requires-Dist: boltons==21.0.0
|
|
27
|
+
Requires-Dist: dateparser==1.1.8
|
|
28
|
+
Requires-Dist: deprecation==2.1.0
|
|
29
|
+
Requires-Dist: h2>=4.4.1
|
|
30
|
+
Requires-Dist: httpx>=0.28.1
|
|
31
|
+
Requires-Dist: humanize>=3.9.0
|
|
32
|
+
Requires-Dist: python_dateutil==2.8.2
|
|
33
|
+
Requires-Dist: pywin32>=301; sys_platform == "win32"
|
|
34
|
+
Requires-Dist: regex<=2022.3.2
|
|
35
|
+
Requires-Dist: setuptools>=67.5.1
|
|
36
|
+
Requires-Dist: sidetrack>=2.0.0
|
|
37
|
+
Requires-Dist: tldextract==3.0.2
|
|
38
|
+
Requires-Dist: validator-collection==1.5.0
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
Dynamic: requires-dist
|
|
25
41
|
|
|
26
42
|
CommonPy<img width="12%" align="right" src="https://github.com/caltechlibrary/commonpy/raw/main/.graphics/commonpy-icon.png">
|
|
27
43
|
===============================================
|
|
@@ -30,7 +46,7 @@ This is a collection of common utility functions and classes that we at the Calt
|
|
|
30
46
|
|
|
31
47
|
[](https://github.com/caltechlibrary/commonpy/releases)
|
|
32
48
|
[](https://choosealicense.com/licenses/bsd-3-clause)
|
|
33
|
-
[](http://shields.io)
|
|
34
50
|
[](https://pypi.org/project/commonpy/)
|
|
35
51
|
|
|
36
52
|
Table of contents
|
|
@@ -171,28 +187,37 @@ The `network_utils` module provides several functions that are useful when perfo
|
|
|
171
187
|
| `hostname(url)` | Returns the hostname portion of a URL |
|
|
172
188
|
| `net(...)` | See below |
|
|
173
189
|
| `netlock(url)` | Returns the hostname, port number (if any), and login info (if any) |
|
|
190
|
+
| `network(...)` | See below |
|
|
174
191
|
| `network_available()` | Returns `True` if external hosts are reacheable over the network |
|
|
175
192
|
| `on_localhost(url)` | Returns `True` if the address of `url` points to the local host |
|
|
176
193
|
| `scheme(url)` | Returns the protocol portion of the url; e.g., "https" |
|
|
177
194
|
|
|
178
195
|
|
|
179
|
-
#### _`net`_
|
|
196
|
+
#### _`network` and `net`_
|
|
180
197
|
|
|
181
|
-
The `net`
|
|
198
|
+
The `network` and `net` functions in the `network_utils` module implements a fairly high-level network operation interface that internally handles timeouts, rate limits, polling, HTTP/2, and more. The function signatures are identical to this:
|
|
182
199
|
|
|
183
200
|
```python
|
|
184
|
-
|
|
201
|
+
network(method, url, client = None, handle_rate = True, polling = False, **kwargs)
|
|
185
202
|
```
|
|
186
203
|
|
|
187
|
-
The
|
|
204
|
+
The difference between the two functions is their behavior with respect to exceptions. The function `network` returns only a `response` object, and raises an exception if any error occurs. The `net` function returns two values: `response, error` and does not raise exceptions except in the case of bad arguments; instead, any exceptions are returned as the `error` value in the list of return values. This allows the caller to inspect the `response` object even in cases where exceptions are raised.
|
|
188
205
|
|
|
189
|
-
|
|
206
|
+
The `response` object returned by both `net` and `network` is the response from the get or post HTTP call. This object comes from the Python [HTTPX](https://www.python-httpx.org) module used by
|
|
190
207
|
|
|
191
|
-
|
|
208
|
+
The `method` parameter value must be a string chosen from the list of known HTTP methods: `"get"`, `"post"`, `"head"`, `"options"`, `"put"`, `"delete"`, or `"patch"`.
|
|
209
|
+
|
|
210
|
+
The `url` parameter value must be the URL to which the HTTP method will be applied.
|
|
211
|
+
|
|
212
|
+
If keyword `client` is not `None`, it's assumed to be a [HTTPX Client](https://www.python-httpx.org/api/#client) object to use for the network call. Settings such as timeouts should be done by the caller creating appropriately-configured [Client](https://www.python-httpx.org/api/#client) objects.
|
|
213
|
+
|
|
214
|
+
If keyword `handle_rate` is `True`, both functions will automatically pause and retry if it receives an HTTP code 429 ("too many requests") from the server. If `False`, it will return the exception `CommonPy.exceptions.RateLimitExceeded` instead.
|
|
192
215
|
|
|
193
216
|
If keyword `polling` is `True`, certain statuses like 404 are ignored and the response is returned; otherwise, they are considered errors. The behavior when `True` is useful in situations where a URL does not exist until something is ready at the server, and the caller is repeatedly checking the URL. It is up to the caller to implement the polling schedule and call this function (with `polling = True`) as needed.
|
|
194
217
|
|
|
195
|
-
|
|
218
|
+
Additional keyword arguments understood by [HTTPX](https://www.python-httpx.org) can be passed to both `network` and `net`.
|
|
219
|
+
|
|
220
|
+
Both methods always pass the argument `allow_redirects = True` to the underlying Python HTTPX library network calls.
|
|
196
221
|
|
|
197
222
|
|
|
198
223
|
#### _`download` and `download_file`_
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = commonpy
|
|
3
|
-
version = 1.13.
|
|
3
|
+
version = 1.13.2
|
|
4
4
|
description = Assortment of Python helper functions and utility classes
|
|
5
5
|
author = Michael Hucka
|
|
6
6
|
author_email = mhucka@caltech.edu
|
|
@@ -21,14 +21,14 @@ classifiers =
|
|
|
21
21
|
Operating System :: POSIX :: Linux
|
|
22
22
|
Operating System :: Unix
|
|
23
23
|
Programming Language :: Python
|
|
24
|
-
Programming Language :: Python :: 3.
|
|
24
|
+
Programming Language :: Python :: 3.10
|
|
25
25
|
long_description = file:README.md
|
|
26
26
|
long_description_content_type = text/markdown
|
|
27
27
|
|
|
28
28
|
[options]
|
|
29
29
|
packages = find:
|
|
30
30
|
zip_safe = False
|
|
31
|
-
python_requires = >= 3.
|
|
31
|
+
python_requires = >= 3.10
|
|
32
32
|
|
|
33
33
|
[egg_info]
|
|
34
34
|
tag_build =
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|