hcs-core 0.1.316__py3-none-any.whl → 0.1.318__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.
hcs_core/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.318"
|
hcs_core/sglib/ez_client.py
CHANGED
|
@@ -175,6 +175,7 @@ class EzClient:
|
|
|
175
175
|
self._init_client(base_url, client)
|
|
176
176
|
self._lazy_init = None
|
|
177
177
|
|
|
178
|
+
self._client_impl.follow_redirects = True
|
|
178
179
|
self._client_impl.ensure_token()
|
|
179
180
|
return self._client_impl
|
|
180
181
|
finally:
|
|
@@ -193,9 +194,29 @@ class EzClient:
|
|
|
193
194
|
# import json as jsonlib
|
|
194
195
|
# print("->", self._client().base_url, url, jsonlib.dumps(json, indent=4))
|
|
195
196
|
try:
|
|
196
|
-
resp = self._client().post(url, json=json, content=text, files=files, headers=headers, timeout=timeout)
|
|
197
|
+
resp = self._client().post(url, json=json, content=text, files=files, headers=headers, timeout=timeout, follow_redirects=True)
|
|
197
198
|
except httpx.HTTPStatusError as e:
|
|
198
|
-
|
|
199
|
+
# the follow_redirects does not work for 307
|
|
200
|
+
if e.response.status_code in [301, 302, 307]:
|
|
201
|
+
target = e.response.headers.get("Location")
|
|
202
|
+
if target:
|
|
203
|
+
client_base_url = str(self._client().base_url)
|
|
204
|
+
default_is_https = client_base_url.startswith("https://")
|
|
205
|
+
target_is_https = target.startswith("https://")
|
|
206
|
+
if default_is_https and not target_is_https:
|
|
207
|
+
target = target.replace("http://", "https://", 1)
|
|
208
|
+
elif not default_is_https and target_is_https:
|
|
209
|
+
target = target.replace("https://", "http://", 1)
|
|
210
|
+
try:
|
|
211
|
+
resp = self._client().post(
|
|
212
|
+
target, json=json, content=text, files=files, headers=headers, timeout=timeout, follow_redirects=True
|
|
213
|
+
)
|
|
214
|
+
except httpx.HTTPStatusError as e:
|
|
215
|
+
_raise_http_error(e)
|
|
216
|
+
else:
|
|
217
|
+
_raise_http_error(e)
|
|
218
|
+
else:
|
|
219
|
+
_raise_http_error(e)
|
|
199
220
|
data = _parse_resp(resp)
|
|
200
221
|
if data and type:
|
|
201
222
|
try:
|
|
@@ -209,7 +230,7 @@ class EzClient:
|
|
|
209
230
|
def get(self, url: str, headers: dict = None, raise_on_404: bool = False, type: Optional[Type[BaseModel]] = None):
|
|
210
231
|
try:
|
|
211
232
|
# print("->", self._client().base_url, url)
|
|
212
|
-
resp = self._client().get(url, headers=headers)
|
|
233
|
+
resp = self._client().get(url, headers=headers, follow_redirects=True)
|
|
213
234
|
data = _parse_resp(resp)
|
|
214
235
|
if data and type:
|
|
215
236
|
try:
|
|
@@ -230,7 +251,7 @@ class EzClient:
|
|
|
230
251
|
|
|
231
252
|
def patch(self, url: str, json: dict = None, text=None, headers: dict = None):
|
|
232
253
|
try:
|
|
233
|
-
resp = self._client().patch(url, json=json, content=text, headers=headers)
|
|
254
|
+
resp = self._client().patch(url, json=json, content=text, headers=headers, follow_redirects=True)
|
|
234
255
|
return _parse_resp(resp)
|
|
235
256
|
except httpx.HTTPStatusError as e:
|
|
236
257
|
_raise_http_error(e)
|
|
@@ -238,7 +259,7 @@ class EzClient:
|
|
|
238
259
|
|
|
239
260
|
def delete(self, url: str, headers: dict = None, raise_on_404: bool = False):
|
|
240
261
|
try:
|
|
241
|
-
resp = self._client().delete(url, headers=headers)
|
|
262
|
+
resp = self._client().delete(url, headers=headers, follow_redirects=True)
|
|
242
263
|
return _parse_resp(resp)
|
|
243
264
|
except httpx.HTTPStatusError as e:
|
|
244
265
|
if _is_404(e):
|
|
@@ -251,7 +272,7 @@ class EzClient:
|
|
|
251
272
|
|
|
252
273
|
def put(self, url: str, json: dict = None, text=None, headers: dict = None):
|
|
253
274
|
try:
|
|
254
|
-
resp = self._client().put(url, json=json, content=text, headers=headers)
|
|
275
|
+
resp = self._client().put(url, json=json, content=text, headers=headers, follow_redirects=True)
|
|
255
276
|
return _parse_resp(resp)
|
|
256
277
|
except httpx.HTTPStatusError as e:
|
|
257
278
|
_raise_http_error(e)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
hcs_core/__init__.py,sha256=
|
|
1
|
+
hcs_core/__init__.py,sha256=Pgalvwj9p3hJv5KnzCETbSpUL1MB6-oYtLT7bVGEEIs,24
|
|
2
2
|
hcs_core/ctxp/__init__.py,sha256=bHVHhJP10Luz1a3Kk3zFx14dAO4SY6Q20Lrv8rNWWGc,1075
|
|
3
3
|
hcs_core/ctxp/_init.py,sha256=fMcRMPfJx-N0c-u0Zj2sFVKQL1-lWQd28gooAZETGUA,2933
|
|
4
4
|
hcs_core/ctxp/cli_options.py,sha256=KFu9_cRB1OyXaZJFLDCb3PpuQ0_5-ou2cdaL_q0_Lns,3098
|
|
@@ -46,7 +46,7 @@ hcs_core/sglib/auth.py,sha256=r9zgLdnybuHsf3_j6nTP4SGoS2dD3keYZ-c25o2Mx64,6766
|
|
|
46
46
|
hcs_core/sglib/cli_options.py,sha256=GBJ59u9iWiCfJt-5F8qw_JGfMRfB-LcLeiKAQkmMh_c,2548
|
|
47
47
|
hcs_core/sglib/client_util.py,sha256=4YH-QoqkpF2DtXhemYx4vM19YBzUWk4iNL2BvYLTDmg,14617
|
|
48
48
|
hcs_core/sglib/csp.py,sha256=UcO68YtLOPDQWiTjPVIPwQ2Z-Mywc-154aoIkLdyzwE,10991
|
|
49
|
-
hcs_core/sglib/ez_client.py,sha256=
|
|
49
|
+
hcs_core/sglib/ez_client.py,sha256=kz136budKkOIj-xFFzaQtkrEl4BEBwyhiKWXYaT6NSQ,9686
|
|
50
50
|
hcs_core/sglib/hcs_client.py,sha256=pjrAVQDEy2tiQMypMpOzODFntT6aNHXjje8or_mkL2U,804
|
|
51
51
|
hcs_core/sglib/init.py,sha256=w_0ZU70Q1TGbSZsqSi7ewKQqpExFlepOT7mIqH0wnho,310
|
|
52
52
|
hcs_core/sglib/login_support.py,sha256=tniRhn4V5eUAgixi_FLTemzBnOrruLgvx6NsLLx3hTA,8077
|
|
@@ -64,6 +64,6 @@ hcs_core/util/query_util.py,sha256=uYfcEF_00eUs_S5OK64zpH0cnb6dwy91_J1OY5ZrFVs,3
|
|
|
64
64
|
hcs_core/util/scheduler.py,sha256=bPpCmGUL1UctJMfLPAg-h4Hl2YZr96FiI78-G_Usn08,2958
|
|
65
65
|
hcs_core/util/ssl_util.py,sha256=MvU102fGwWWh9hhSmLnn1qQIWuD6TjZnN0iH0MXUtW0,1239
|
|
66
66
|
hcs_core/util/versions.py,sha256=6nyyZzi3P69WQfioPc2_YWZQcUc13mC1eKoK58b3WUQ,1709
|
|
67
|
-
hcs_core-0.1.
|
|
68
|
-
hcs_core-0.1.
|
|
69
|
-
hcs_core-0.1.
|
|
67
|
+
hcs_core-0.1.318.dist-info/METADATA,sha256=Pk5g7sHejK_DlLaWP0rGTbbPVlLb7-C7L1oFMM-0haA,1918
|
|
68
|
+
hcs_core-0.1.318.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
69
|
+
hcs_core-0.1.318.dist-info/RECORD,,
|
|
File without changes
|