python-urlopen 0.0.1__tar.gz → 0.0.1.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-urlopen
3
- Version: 0.0.1
3
+ Version: 0.0.1.1
4
4
  Summary: Python urlopen wrapper.
5
5
  Home-page: https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-urlopen
6
6
  License: MIT
@@ -23,6 +23,7 @@ Classifier: Topic :: Software Development :: Libraries
23
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
24
  Requires-Dist: http_response
25
25
  Requires-Dist: python-filewrap
26
+ Requires-Dist: python-iterutils
26
27
  Project-URL: Repository, https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-urlopen
27
28
  Description-Content-Type: text/markdown
28
29
 
@@ -38,8 +39,31 @@ pip install -U python-urlopen
38
39
 
39
40
  ## Usage
40
41
 
42
+ ### Module
43
+
41
44
  ```python
42
45
  from urlopen import urlopen
43
46
  ```
44
47
 
48
+ ### Command
49
+
50
+ ```console
51
+ $ python -m urlopen -h
52
+ usage: __main__.py [-h] [-d SAVEDIR] [-r] [-hs HEADERS] [-v] [url ...]
53
+
54
+ python url downloader
55
+
56
+ positional arguments:
57
+ url URL(s) to be downloaded (one URL per line), if omitted, read from stdin
58
+
59
+ options:
60
+ -h, --help show this help message and exit
61
+ -d SAVEDIR, --savedir SAVEDIR
62
+ directory to the downloading files
63
+ -r, --resume skip downloaded data
64
+ -hs HEADERS, --headers HEADERS
65
+ dictionary of HTTP Headers to send with
66
+ -v, --version print the current version
67
+ ```
68
+
45
69
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-urlopen"
3
- version = "0.0.1"
3
+ version = "0.0.1.1"
4
4
  description = "Python urlopen wrapper."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"
@@ -29,6 +29,7 @@ include = [
29
29
  python = "^3.10"
30
30
  http_response = "*"
31
31
  python-filewrap = "*"
32
+ python-iterutils = "*"
32
33
 
33
34
  [build-system]
34
35
  requires = ["poetry-core"]
@@ -0,0 +1,39 @@
1
+ # Python urlopen wrapper.
2
+
3
+ ## Installation
4
+
5
+ You can install via [pypi](https://pypi.org/project/python-urlopen/)
6
+
7
+ ```console
8
+ pip install -U python-urlopen
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Module
14
+
15
+ ```python
16
+ from urlopen import urlopen
17
+ ```
18
+
19
+ ### Command
20
+
21
+ ```console
22
+ $ python -m urlopen -h
23
+ usage: __main__.py [-h] [-d SAVEDIR] [-r] [-hs HEADERS] [-v] [url ...]
24
+
25
+ python url downloader
26
+
27
+ positional arguments:
28
+ url URL(s) to be downloaded (one URL per line), if omitted, read from stdin
29
+
30
+ options:
31
+ -h, --help show this help message and exit
32
+ -d SAVEDIR, --savedir SAVEDIR
33
+ directory to the downloading files
34
+ -r, --resume skip downloaded data
35
+ -hs HEADERS, --headers HEADERS
36
+ dictionary of HTTP Headers to send with
37
+ -v, --version print the current version
38
+ ```
39
+
@@ -20,8 +20,9 @@ from typing import cast, Any, Optional
20
20
  from urllib.parse import urlencode, urlsplit
21
21
  from urllib.request import build_opener, HTTPSHandler, OpenerDirector, Request
22
22
 
23
- from filewrap import bio_skip_bytes, SupportsRead, SupportsWrite
23
+ from filewrap import bio_skip_iter, SupportsRead, SupportsWrite
24
24
  from http_response import get_filename, get_length, is_chunked, is_range_request
25
+ from iterutils import foreach
25
26
 
26
27
 
27
28
  if "__del__" not in HTTPResponse.__dict__:
@@ -195,7 +196,7 @@ def download(
195
196
  if reporthook:
196
197
  reporthook(filesize)
197
198
  elif resume:
198
- bio_skip_bytes(resp, filesize, callback=reporthook)
199
+ foreach(bio_skip_iter(resp, filesize, callback=reporthook))
199
200
 
200
201
  fsrc_read = resp.read
201
202
  fdst_write = fdst.write
@@ -1,16 +0,0 @@
1
- # Python urlopen wrapper.
2
-
3
- ## Installation
4
-
5
- You can install via [pypi](https://pypi.org/project/python-urlopen/)
6
-
7
- ```console
8
- pip install -U python-urlopen
9
- ```
10
-
11
- ## Usage
12
-
13
- ```python
14
- from urlopen import urlopen
15
- ```
16
-
File without changes