python-httpfile 0.0.5.2__py3-none-any.whl → 0.0.5.3__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.
httpfile/__init__.py CHANGED
@@ -18,7 +18,6 @@ from io import (
18
18
  )
19
19
  from os import fstat, stat, PathLike
20
20
  from shutil import COPY_BUFSIZE # type: ignore
21
- from sys import exc_info
22
21
  from typing import cast, overload, Any, BinaryIO, Literal, Self
23
22
  from types import MappingProxyType
24
23
  from warnings import warn
@@ -27,7 +26,6 @@ from asynctools import ensure_async, run_async
27
26
  from filewrap import AsyncBufferedReader, AsyncTextIOWrapper
28
27
  from http_response import get_filename, get_length, get_range, get_total_length, is_chunked, is_range_request
29
28
  from property import funcproperty
30
- from urlopen import urlopen
31
29
 
32
30
 
33
31
  def get_filesize(
@@ -103,7 +101,7 @@ class HTTPFileReader(RawIOBase, BinaryIO):
103
101
  # NOTE: If the offset of the forward seek is not higher than this value,
104
102
  # it will be directly read and discarded, default to 1 MB
105
103
  seek_threshold: int = 1 << 20,
106
- urlopen = urlopen,
104
+ urlopen = None,
107
105
  ):
108
106
  if headers:
109
107
  headers = {**headers, "accept-encoding": "identity"}
@@ -114,7 +112,7 @@ class HTTPFileReader(RawIOBase, BinaryIO):
114
112
  elif start < 0:
115
113
  headers["range"] = f"bytes={start}"
116
114
  if urlopen is None:
117
- urlopen = globals()["urlopen"]
115
+ from http_request.extension.request import urlopen
118
116
  if callable(url):
119
117
  geturl = url
120
118
  def url():
@@ -510,7 +508,7 @@ class HTTPFileReader(RawIOBase, BinaryIO):
510
508
  else:
511
509
  buffer_size = buffering
512
510
  raw = self
513
- buffer = BufferedReader(raw, buffer_size)
511
+ buffer: BufferedReader = BufferedReader(raw, buffer_size)
514
512
  if text_mode:
515
513
  return TextIOWrapper(
516
514
  buffer,
@@ -580,7 +578,7 @@ class AsyncHTTPFileReader(HTTPFileReader):
580
578
  elif start < 0:
581
579
  headers["range"] = f"bytes={start}"
582
580
  if urlopen is None:
583
- urlopen = globals()["urlopen"]
581
+ from http_request.extension.request import urlopen
584
582
  if callable(url):
585
583
  geturl = url
586
584
  async def url() -> str:
@@ -1050,8 +1048,6 @@ if find_spec("requests"):
1050
1048
 
1051
1049
 
1052
1050
  if find_spec("aiohttp"):
1053
- from types import MethodType
1054
-
1055
1051
  _aiohttp_urlopen = None
1056
1052
 
1057
1053
  class AiohttpFileReader(AsyncHTTPFileReader):
@@ -1230,6 +1226,6 @@ if find_spec("httpx"):
1230
1226
  __all__.append("HttpxFileReader")
1231
1227
  __all__.append("AsyncHttpxFileReader")
1232
1228
 
1233
- # TODO: 增加 blacksheep HTTPFileReader
1229
+ # TODO: 实现任意请求模块的 HTTPFileReader,只要它支持流式读取即可(分成 2 种类型:要么支持 read,要么支持迭代器)
1234
1230
  # TODO: 设计实现一个 HTTPFileWriter,用于实现上传,关闭后视为上传完成
1235
1231
  # TODO: httpx 重新实现 stream 和 async_stream 方法,确保不需要用上下文管理器,如此才能真的简化
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: python-httpfile
3
- Version: 0.0.5.2
3
+ Version: 0.0.5.3
4
4
  Summary: Python httpfile.
5
- Home-page: https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-httpfile
6
5
  License: MIT
6
+ License-File: LICENSE
7
7
  Keywords: http,file,wrapper
8
8
  Author: ChenyangGao
9
9
  Author-email: wosiwujm@gmail.com
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.10
18
18
  Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
21
22
  Classifier: Programming Language :: Python :: 3 :: Only
22
23
  Classifier: Topic :: Software Development
23
24
  Classifier: Topic :: Software Development :: Libraries
@@ -27,7 +28,8 @@ Requires-Dist: python-asynctools (>=0.0.5)
27
28
  Requires-Dist: python-filewrap (>=0.2.1)
28
29
  Requires-Dist: python-property (>=0.0.2)
29
30
  Requires-Dist: python-urlopen (>=0.0.7.1)
30
- Project-URL: Repository, https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-httpfile
31
+ Project-URL: Homepage, https://github.com/ChenyangGao/python-modules/tree/main/python-httpfile
32
+ Project-URL: Repository, https://github.com/ChenyangGao/python-modules/tree/main/python-httpfile
31
33
  Description-Content-Type: text/markdown
32
34
 
33
35
  # Python httpfile.
@@ -0,0 +1,6 @@
1
+ httpfile/__init__.py,sha256=vdI9_1Smyy-Phaxo8wDGVkH_ti7Ba1c5GkWM_-qqVIg,39672
2
+ httpfile/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ python_httpfile-0.0.5.3.dist-info/METADATA,sha256=0uofeQZx13DCW4JhUFu8_YNsExBvNOLcxDoRehDqNRM,1628
4
+ python_httpfile-0.0.5.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
5
+ python_httpfile-0.0.5.3.dist-info/licenses/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
6
+ python_httpfile-0.0.5.3.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.1
2
+ Generator: poetry-core 2.2.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 ChenyangGao <https://github.com/ChenyangGao>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,7 +0,0 @@
1
- LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
2
- httpfile/__init__.py,sha256=Yvl34ufRAYFn2-838EsMrI76b35RIUs7Eoe6w1By9nI,39596
3
- httpfile/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- python_httpfile-0.0.5.2.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
5
- python_httpfile-0.0.5.2.dist-info/METADATA,sha256=uDfS48QDTCjGCV_6JPeWZFwQZWUnjYnmrM0D-GGK_mw,1573
6
- python_httpfile-0.0.5.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
7
- python_httpfile-0.0.5.2.dist-info/RECORD,,