python-http_request 0.1.6.2__tar.gz → 0.1.6.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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-http_request
3
- Version: 0.1.6.2
3
+ Version: 0.1.6.3
4
4
  Summary: Python http request utils.
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -150,8 +150,6 @@ def urlopen(
150
150
  headers=None,
151
151
  **request_kwargs,
152
152
  ) -> HTTPResponse:
153
- if headers is None:
154
- headers = {}
155
153
  urlp = urlsplit(url)
156
154
  if urlp.scheme == "https":
157
155
  con: HTTPConnection = HTTPSConnection(urlp.netloc)
@@ -161,10 +159,13 @@ def urlopen(
161
159
  method,
162
160
  urlunsplit(urlp._replace(scheme="", netloc="")),
163
161
  data,
164
- headers,
162
+ {} if headers is None else headers,
165
163
  )
166
164
  socket_keepalive(con.sock)
167
- return con.getresponse()
165
+ resp = con.getresponse()
166
+ setattr(resp, "method", method.upper())
167
+ setattr(resp, "url", url)
168
+ return resp
168
169
 
169
170
 
170
171
  urlopen_async = lambda *a, **k: to_thread(urlopen, *a, **k)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-http_request"
3
- version = "0.1.6.2"
3
+ version = "0.1.6.3"
4
4
  description = "Python http request utils."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"