kbot-py-client 2.0.3__tar.gz → 2.0.4__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.
- {kbot_py_client-2.0.3/kbot_py_client.egg-info → kbot_py_client-2.0.4}/PKG-INFO +1 -1
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/kbot_client/client.py +8 -4
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/kbot_client/client.recording.py +1 -3
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4/kbot_py_client.egg-info}/PKG-INFO +1 -1
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/setup.py +1 -1
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/.gitignore +0 -0
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/LICENSE +0 -0
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/README.md +0 -0
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/kbot_client/__init__.py +0 -0
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/kbot_client/chat_client.py +0 -0
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/kbot_client/client_group.py +0 -0
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/kbot_client/folder_sync.py +0 -0
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/kbot_client/test.py +0 -0
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/kbot_py_client.egg-info/SOURCES.txt +0 -0
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/kbot_py_client.egg-info/dependency_links.txt +0 -0
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/kbot_py_client.egg-info/requires.txt +0 -0
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/kbot_py_client.egg-info/top_level.txt +0 -0
- {kbot_py_client-2.0.3 → kbot_py_client-2.0.4}/setup.cfg +0 -0
|
@@ -176,7 +176,11 @@ class Client:
|
|
|
176
176
|
self.__reset_headers(r.json())
|
|
177
177
|
|
|
178
178
|
def __request(self, method: str, uri : str = None, data: dict = None, params: dict = None, files: dict = None, attempt=0):
|
|
179
|
-
|
|
179
|
+
if files:
|
|
180
|
+
# For file upload, the data must be a dictionnary
|
|
181
|
+
dump_data = data
|
|
182
|
+
else:
|
|
183
|
+
dump_data = json.dumps(data or {})
|
|
180
184
|
|
|
181
185
|
if files:
|
|
182
186
|
headers = self._headers.copy()
|
|
@@ -185,7 +189,7 @@ class Client:
|
|
|
185
189
|
else:
|
|
186
190
|
headers = self._headers
|
|
187
191
|
|
|
188
|
-
r = requests.request(method.upper(), self.url + '/api/%s/' % (uri), params=params, data=dump_data, headers=headers, verify=self.verify)
|
|
192
|
+
r = requests.request(method.upper(), self.url + '/api/%s/' % (uri), params=params, data=dump_data, headers=headers, files=files, verify=self.verify)
|
|
189
193
|
|
|
190
194
|
if r.status_code == 401:
|
|
191
195
|
# Refresh the token
|
|
@@ -204,8 +208,8 @@ class Client:
|
|
|
204
208
|
|
|
205
209
|
return r
|
|
206
210
|
|
|
207
|
-
def request(self, method: str, uri: str, data: dict = None, params: dict = None):
|
|
208
|
-
return self.__request(method, uri=uri, data=data, params=params)
|
|
211
|
+
def request(self, method: str, uri: str, data: dict = None, params: dict = None, files: dict = None):
|
|
212
|
+
return self.__request(method, uri=uri, data=data, params=params, files=files)
|
|
209
213
|
|
|
210
214
|
def unit(self, name: str, params=None) -> dict:
|
|
211
215
|
r = self.get(name, params)
|
|
@@ -28,9 +28,7 @@ class Client:
|
|
|
28
28
|
else:
|
|
29
29
|
proto = 'http'
|
|
30
30
|
|
|
31
|
-
if
|
|
32
|
-
self.url = "%s://%s" % (proto, server)
|
|
33
|
-
elif proto == "https" and port == 443:
|
|
31
|
+
if port in (80, 443):
|
|
34
32
|
self.url = "%s://%s" % (proto, server)
|
|
35
33
|
else:
|
|
36
34
|
self.url = "%s://%s:%s" % (proto, server, port)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|