(self, url, type, jsonData, **kwargs)
| 98 | raise Error(error) |
| 99 | |
| 100 | def post(self, url, type, jsonData, **kwargs): |
| 101 | self.__networkAccessCheck(type) |
| 102 | |
| 103 | headers = self.__getHeaders() |
| 104 | proxies = self.__getProxies() |
| 105 | |
| 106 | try: |
| 107 | resp = requests.post(url, json=jsonData, headers=headers, proxies=proxies, **kwargs) |
| 108 | resp.raise_for_status() |
| 109 | return resp |
| 110 | except requests.exceptions.HTTPError as error: |
| 111 | pyfalog.warning('HTTPError:') |
| 112 | pyfalog.warning(error) |
| 113 | if error.response.status_code == 404: |
| 114 | raise RequestError() |
| 115 | elif error.response.status_code == 403: |
| 116 | raise AuthenticationError() |
| 117 | elif error.response.status_code >= 500: |
| 118 | raise ServerError() |
| 119 | raise Error(error) |
| 120 | except requests.exceptions.Timeout: |
| 121 | raise TimeoutError() |
| 122 | except (KeyboardInterrupt, SystemExit): |
| 123 | raise |
| 124 | except Exception as error: |
| 125 | raise Error(error) |
| 126 | |
| 127 | def __networkAccessCheck(self, type): |
| 128 | # Make sure request is enabled |
nothing calls this directly
no test coverage detected