mm-std 0.4.13__py3-none-any.whl → 0.4.15__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.
- mm_std/http/http_request.py +6 -1
- mm_std/http/http_request_sync.py +9 -4
- mm_std/http/http_response.py +1 -0
- {mm_std-0.4.13.dist-info → mm_std-0.4.15.dist-info}/METADATA +1 -1
- {mm_std-0.4.13.dist-info → mm_std-0.4.15.dist-info}/RECORD +6 -6
- {mm_std-0.4.13.dist-info → mm_std-0.4.15.dist-info}/WHEEL +0 -0
mm_std/http/http_request.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import aiohttp
|
2
|
+
from aiohttp import ClientHttpProxyError, InvalidUrlClientError
|
2
3
|
from aiohttp.typedefs import LooseCookies, Query
|
3
|
-
from aiohttp_socks import ProxyConnector
|
4
|
+
from aiohttp_socks import ProxyConnectionError, ProxyConnector
|
4
5
|
from multidict import CIMultiDictProxy
|
5
6
|
|
6
7
|
from mm_std.http.http_response import HttpError, HttpResponse
|
@@ -54,6 +55,10 @@ async def http_request(
|
|
54
55
|
)
|
55
56
|
except TimeoutError as err:
|
56
57
|
return HttpResponse(error=HttpError.TIMEOUT, error_message=str(err))
|
58
|
+
except (aiohttp.ClientProxyConnectionError, ProxyConnectionError, ClientHttpProxyError) as err:
|
59
|
+
return HttpResponse(error=HttpError.PROXY, error_message=str(err))
|
60
|
+
except InvalidUrlClientError as e:
|
61
|
+
return HttpResponse(error=HttpError.INVALID_URL, error_message=str(e))
|
57
62
|
except Exception as err:
|
58
63
|
return HttpResponse(error=HttpError.ERROR, error_message=str(err))
|
59
64
|
|
mm_std/http/http_request_sync.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
from typing import Any
|
2
2
|
|
3
3
|
import requests
|
4
|
+
from requests.exceptions import InvalidSchema, MissingSchema, ProxyError
|
4
5
|
|
5
6
|
from mm_std.http.http_response import HttpError, HttpResponse
|
6
7
|
|
@@ -52,7 +53,11 @@ def http_request_sync(
|
|
52
53
|
body=res.text,
|
53
54
|
headers=dict(res.headers),
|
54
55
|
)
|
55
|
-
except requests.Timeout as
|
56
|
-
return HttpResponse(error=HttpError.TIMEOUT, error_message=str(
|
57
|
-
except
|
58
|
-
return HttpResponse(error=HttpError.
|
56
|
+
except requests.Timeout as e:
|
57
|
+
return HttpResponse(error=HttpError.TIMEOUT, error_message=str(e))
|
58
|
+
except ProxyError as e:
|
59
|
+
return HttpResponse(error=HttpError.PROXY, error_message=str(e))
|
60
|
+
except (InvalidSchema, MissingSchema) as e:
|
61
|
+
return HttpResponse(error=HttpError.INVALID_URL, error_message=str(e))
|
62
|
+
except Exception as e:
|
63
|
+
return HttpResponse(error=HttpError.ERROR, error_message=str(e))
|
mm_std/http/http_response.py
CHANGED
@@ -25,9 +25,9 @@ mm_std/concurrency/sync_decorators.py,sha256=syCQBOmN7qPO55yzgJB2rbkh10CVww376hm
|
|
25
25
|
mm_std/concurrency/sync_scheduler.py,sha256=j4tBL_cBI1spr0cZplTA7N2CoYsznuORMeRN8rpR6gY,2407
|
26
26
|
mm_std/concurrency/sync_task_runner.py,sha256=s5JPlLYLGQGHIxy4oDS-PN7O9gcy-yPZFoNm8RQwzcw,1780
|
27
27
|
mm_std/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
|
-
mm_std/http/http_request.py,sha256=
|
29
|
-
mm_std/http/http_request_sync.py,sha256=
|
30
|
-
mm_std/http/http_response.py,sha256=
|
31
|
-
mm_std-0.4.
|
32
|
-
mm_std-0.4.
|
33
|
-
mm_std-0.4.
|
28
|
+
mm_std/http/http_request.py,sha256=6bg3t49c3dG0jKRFxhcceeYb5yKrMoZwuyb25zBG3tY,4088
|
29
|
+
mm_std/http/http_request_sync.py,sha256=zXLeDplYWTFIwaD1Ydyg9yTi37WcI-fReLM0mVnuvhM,1835
|
30
|
+
mm_std/http/http_response.py,sha256=7ZllZFPKJ9s6m-18Dfhrm7hwc2XFnyX7ppt0O8gNmlE,3916
|
31
|
+
mm_std-0.4.15.dist-info/METADATA,sha256=D84z19NQ9EnTxan0l2149jLv-V8ZhMmLJrmkKM4ufRg,415
|
32
|
+
mm_std-0.4.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
33
|
+
mm_std-0.4.15.dist-info/RECORD,,
|
File without changes
|