python-httpfile 0.0.5.2__tar.gz → 0.0.5.3__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,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.
@@ -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,12 +1,12 @@
1
1
  [tool.poetry]
2
2
  name = "python-httpfile"
3
- version = "0.0.5.2"
3
+ version = "0.0.5.3"
4
4
  description = "Python httpfile."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"
7
7
  readme = "readme.md"
8
- homepage = "https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-httpfile"
9
- repository = "https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-httpfile"
8
+ homepage = "https://github.com/ChenyangGao/python-modules/tree/main/python-httpfile"
9
+ repository = "https://github.com/ChenyangGao/python-modules/tree/main/python-httpfile"
10
10
  keywords = ["http", "file", "wrapper"]
11
11
  classifiers = [
12
12
  "License :: OSI Approved :: MIT License",