pytolino 1.4__py3-none-any.whl → 1.6__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.
- pytolino/tolino_cloud.py +15 -1
- {pytolino-1.4.dist-info → pytolino-1.6.dist-info}/METADATA +10 -9
- pytolino-1.6.dist-info/RECORD +8 -0
- {pytolino-1.4.dist-info → pytolino-1.6.dist-info}/WHEEL +1 -1
- pytolino-1.4.dist-info/RECORD +0 -8
- {pytolino-1.4.dist-info → pytolino-1.6.dist-info/licenses}/LICENSE +0 -0
- {pytolino-1.4.dist-info → pytolino-1.6.dist-info}/top_level.txt +0 -0
pytolino/tolino_cloud.py
CHANGED
|
@@ -6,11 +6,13 @@ import configparser
|
|
|
6
6
|
import platform
|
|
7
7
|
import logging
|
|
8
8
|
from urllib.parse import urlparse, parse_qs
|
|
9
|
+
from urllib3.util import Retry
|
|
9
10
|
import json
|
|
10
11
|
import time
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
import requests
|
|
15
|
+
from requests.adapters import HTTPAdapter
|
|
14
16
|
import mechanize
|
|
15
17
|
|
|
16
18
|
|
|
@@ -27,6 +29,8 @@ servers_settings = configparser.ConfigParser()
|
|
|
27
29
|
servers_settings.read(SERVERS_SETTINGS_FILE_PATH)
|
|
28
30
|
|
|
29
31
|
PARTNERS = servers_settings.sections()
|
|
32
|
+
TOTAL_RETRY =5
|
|
33
|
+
STATUS_FORCELIST = [404]
|
|
30
34
|
|
|
31
35
|
|
|
32
36
|
def main():
|
|
@@ -124,8 +128,17 @@ class Client(object):
|
|
|
124
128
|
self.token_expires = None
|
|
125
129
|
|
|
126
130
|
self.server_settings = servers_settings[server_name]
|
|
127
|
-
self.session = requests.
|
|
131
|
+
self.session = requests.Session()
|
|
132
|
+
retry_strategy = Retry(
|
|
133
|
+
total=TOTAL_RETRY,
|
|
134
|
+
status_forcelist=STATUS_FORCELIST,
|
|
135
|
+
backoff_factor=2,
|
|
136
|
+
allowed_methods=frozenset(['GET', 'POST']))
|
|
137
|
+
adapter = HTTPAdapter(max_retries=retry_strategy)
|
|
138
|
+
self.session.mount('http://', adapter)
|
|
139
|
+
self.session.mount('https://', adapter)
|
|
128
140
|
self.browser = mechanize.Browser()
|
|
141
|
+
self.browser.set_handle_robots(False)
|
|
129
142
|
self.server_name = server_name
|
|
130
143
|
|
|
131
144
|
def login(self, username, password):
|
|
@@ -195,6 +208,7 @@ class Client(object):
|
|
|
195
208
|
allow_redirects=False,
|
|
196
209
|
)
|
|
197
210
|
self._log_requests(host_response)
|
|
211
|
+
|
|
198
212
|
try:
|
|
199
213
|
j = host_response.json()
|
|
200
214
|
self.access_token = j['access_token']
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pytolino
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6
|
|
4
4
|
Summary: client for tolino cloud
|
|
5
5
|
Author: Imam Usmani
|
|
6
6
|
Project-URL: Source Code, https://github.com/ImamAzim/pytolino
|
|
@@ -16,13 +16,14 @@ License-File: LICENSE
|
|
|
16
16
|
Requires-Dist: requests
|
|
17
17
|
Requires-Dist: mechanize
|
|
18
18
|
Provides-Extra: dev
|
|
19
|
-
Requires-Dist: pytest
|
|
20
|
-
Requires-Dist: flake8
|
|
21
|
-
Requires-Dist: ipython
|
|
22
|
-
Requires-Dist: sphinx
|
|
23
|
-
Requires-Dist: build
|
|
24
|
-
Requires-Dist: twine
|
|
25
|
-
Requires-Dist: sphinx-rtd-theme
|
|
19
|
+
Requires-Dist: pytest; extra == "dev"
|
|
20
|
+
Requires-Dist: flake8; extra == "dev"
|
|
21
|
+
Requires-Dist: ipython; extra == "dev"
|
|
22
|
+
Requires-Dist: sphinx; extra == "dev"
|
|
23
|
+
Requires-Dist: build; extra == "dev"
|
|
24
|
+
Requires-Dist: twine; extra == "dev"
|
|
25
|
+
Requires-Dist: sphinx-rtd-theme; extra == "dev"
|
|
26
|
+
Dynamic: license-file
|
|
26
27
|
|
|
27
28
|
pytolino
|
|
28
29
|
===================
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
pytolino/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
pytolino/servers_settings.ini,sha256=IDhstCWbLHaMj3qEOYcbDABaIUKHIz1jEBke3uSE8bI,1473
|
|
3
|
+
pytolino/tolino_cloud.py,sha256=HwrEil5FT-L-4jebc4mC9ThdlgEUGIGc719wqbJpBdY,19239
|
|
4
|
+
pytolino-1.6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
5
|
+
pytolino-1.6.dist-info/METADATA,sha256=FkfXV1lncQyg66TrLTI_l_rGLQ2VjBq6CCuB-MUMvks,3725
|
|
6
|
+
pytolino-1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
pytolino-1.6.dist-info/top_level.txt,sha256=3stGCqihEMMqlWGkME45OTJ0Prg-FO_kl554rtYNeuU,9
|
|
8
|
+
pytolino-1.6.dist-info/RECORD,,
|
pytolino-1.4.dist-info/RECORD
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
pytolino/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
pytolino/servers_settings.ini,sha256=IDhstCWbLHaMj3qEOYcbDABaIUKHIz1jEBke3uSE8bI,1473
|
|
3
|
-
pytolino/tolino_cloud.py,sha256=xK0I8cQA3PXr2Z-WVBkIPecAYTpvSLpqhGCFVY59W9o,18714
|
|
4
|
-
pytolino-1.4.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
5
|
-
pytolino-1.4.dist-info/METADATA,sha256=QiqUQseyV-vifg2XolSkvfZBxvkZWDWRFm_XaPWLbzw,3710
|
|
6
|
-
pytolino-1.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
7
|
-
pytolino-1.4.dist-info/top_level.txt,sha256=3stGCqihEMMqlWGkME45OTJ0Prg-FO_kl554rtYNeuU,9
|
|
8
|
-
pytolino-1.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|