httpx_request 0.1__tar.gz → 0.1.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: httpx_request
3
- Version: 0.1
3
+ Version: 0.1.2
4
4
  Summary: httpx request extension.
5
5
  Home-page: https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/httpx_request
6
6
  License: MIT
@@ -17,6 +17,7 @@ Classifier: Programming Language :: Python :: 3
17
17
  Classifier: Programming Language :: Python :: 3.10
18
18
  Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
20
21
  Classifier: Programming Language :: Python :: 3 :: Only
21
22
  Classifier: Topic :: Software Development
22
23
  Classifier: Topic :: Software Development :: Libraries
@@ -2,17 +2,16 @@
2
2
  # coding: utf-8
3
3
 
4
4
  __author__ = "ChenyangGao <https://chenyanggao.github.io>"
5
- __version__ = (0, 1)
5
+ __version__ = (0, 1, 1)
6
6
  __all__ = ["request", "request_sync", "request_async"]
7
7
 
8
- from asyncio import create_task, get_running_loop, run, run_coroutine_threadsafe
8
+ from asyncio import get_running_loop, run, run_coroutine_threadsafe
9
9
  from collections.abc import Awaitable, Callable
10
10
  from contextlib import aclosing, closing
11
11
  from inspect import isawaitable, signature
12
12
  from json import loads
13
- from ssl import SSLContext
14
13
  from types import EllipsisType
15
- from typing import cast, overload, Any, Literal, TypeVar
14
+ from typing import cast, overload, Any, Literal
16
15
 
17
16
  from argtools import argcount
18
17
  from httpx import AsyncHTTPTransport, HTTPTransport
@@ -26,8 +25,8 @@ _CLIENT_INIT_KWARGS = signature(Client).parameters.keys() - _BUILD_REQUEST_KWARG
26
25
  if "__del__" not in Client.__dict__:
27
26
  setattr(Client, "__del__", Client.close)
28
27
 
29
- if "__del__" not in AsyncClient.__dict__:
30
- def __del__(self, /):
28
+ if "close" not in AsyncClient.__dict__:
29
+ def close(self, /):
31
30
  try:
32
31
  try:
33
32
  loop = get_running_loop()
@@ -37,7 +36,10 @@ if "__del__" not in AsyncClient.__dict__:
37
36
  run_coroutine_threadsafe(self.aclose(), loop)
38
37
  except Exception:
39
38
  pass
40
- setattr(Client, "__del__", __del__)
39
+ setattr(AsyncClient, "close", close)
40
+ if "__del__" not in AsyncClient.__dict__:
41
+ setattr(AsyncClient, "__del__", close)
42
+
41
43
 
42
44
  if "__del__" not in Response.__dict__:
43
45
  def __del__(self, /):
@@ -89,7 +91,7 @@ def request_sync(
89
91
  follow_redirects=follow_redirects,
90
92
  stream=stream,
91
93
  )
92
- if raise_for_status:
94
+ if resp.status_code >= 400 and raise_for_status:
93
95
  resp.raise_for_status()
94
96
  if parse is None:
95
97
  return resp
@@ -147,7 +149,7 @@ async def request_async(
147
149
  follow_redirects=follow_redirects,
148
150
  stream=stream,
149
151
  )
150
- if raise_for_status:
152
+ if resp.status_code >= 400 and raise_for_status:
151
153
  resp.raise_for_status()
152
154
  if parse is None:
153
155
  return resp
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "httpx_request"
3
- version = "0.1"
3
+ version = "0.1.2"
4
4
  description = "httpx request extension."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"
File without changes
File without changes