diff options
Diffstat (limited to 'src/caas/services/httpclient.py')
| -rw-r--r-- | src/caas/services/httpclient.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/caas/services/httpclient.py b/src/caas/services/httpclient.py new file mode 100644 index 0000000..ad8270b --- /dev/null +++ b/src/caas/services/httpclient.py @@ -0,0 +1,18 @@ +import requests +from requests.packages.urllib3.exceptions import InsecureRequestWarning +from requests.auth import HTTPBasicAuth + + +class HttpClient(object): + def __init__(self): + requests.packages.urllib3.disable_warnings(InsecureRequestWarning) + self.session = requests.Session() + + def post(self, url, username, password, data = None, headers = {}, timeout = 60): + resp = self.session.post(url = url, + auth = HTTPBasicAuth(username, password), + json = data, + headers = headers, + timeout = timeout, + verify = False) + return resp |
