PyQuantimClient 1.0.82__tar.gz → 1.0.83__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyQuantimClient
3
- Version: 1.0.82
3
+ Version: 1.0.83
4
4
  Summary: Python client to access quantIM services
5
5
  Author: Daniel Velasquez
6
6
  Author-email: daniel.velasquez@sura-im.com
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyQuantimClient
3
- Version: 1.0.82
3
+ Version: 1.0.83
4
4
  Summary: Python client to access quantIM services
5
5
  Author: Daniel Velasquez
6
6
  Author-email: daniel.velasquez@sura-im.com
@@ -4,7 +4,7 @@ setup(
4
4
  name='PyQuantimClient',
5
5
  packages=['PyQuantimClient'],
6
6
  package_dir={'PyQuantimClient': 'src'},
7
- version='1.0.82',
7
+ version='1.0.83',
8
8
  description='Python client to access quantIM services',
9
9
  author='Daniel Velasquez',
10
10
  author_email='daniel.velasquez@sura-im.com',
@@ -15,8 +15,7 @@ class quantim:
15
15
  else:
16
16
  self.api_url = api_url
17
17
 
18
- def get_header(self):
19
-
18
+ def get_token(self):
20
19
  if self.secretpool=='ALM':
21
20
  token_url = f"{self.api_url}token"
22
21
  data = {"username":self.username, "password":self.password}
@@ -24,10 +23,17 @@ class quantim:
24
23
  token_url = f"{self.api_url}tokendynamicpool"
25
24
  data = {"username":self.username, "password":self.password, "secretpool":self.secretpool}
26
25
 
27
- headers = {"Accept": "*/*",'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*'}
28
26
  access_token_response = requests.post(token_url, data=json.dumps(data), headers=headers, verify=False, allow_redirects=False)
29
27
  tokens = json.loads(access_token_response.text)
30
28
  access_token = tokens['id_token']
29
+
30
+ return access_token
31
+
32
+ def get_header(self):
33
+ '''
34
+ Build request header
35
+ '''
36
+ access_token = self.get_token()
31
37
  api_call_headers = {"Accept": "*/*", 'Authorization': 'Bearer ' + access_token, 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*'}
32
38
 
33
39
  return api_call_headers