-
Notifications
You must be signed in to change notification settings - Fork 141
/
Copy pathclient.py
29 lines (21 loc) · 796 Bytes
/
client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-
# © 2016 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import requests
import suds.client
import suds_requests
def get_authenticated_client(base_url, cert, key):
cache_location = "/tmp/suds"
cache = suds.cache.DocumentCache(location=cache_location)
session = requests.Session()
session.cert = (cert, key)
return suds.client.Client(
base_url, cache=cache, transport=suds_requests.RequestsTransport(session)
)
def get_client(base_url):
cache_location = "/tmp/suds"
cache = suds.cache.DocumentCache(location=cache_location)
session = requests.Session()
return suds.client.Client(
base_url, cache=cache, transport=suds_requests.RequestsTransport(session)
)