|
40 | 40 | MSG_TOKEN_EXPIRED,
|
41 | 41 | )
|
42 | 42 | from eos_downloader.data import DATA_MAPPING
|
43 |
| -from eos_downloader.download import DownloadProgressBar |
| 43 | +from eos_downloader.download import DownloadProgressBar, REQUEST_HEADERS |
44 | 44 |
|
45 | 45 | # logger = logging.getLogger(__name__)
|
46 | 46 |
|
@@ -263,7 +263,10 @@ def get_folder_tree(self) -> ET.ElementTree:
|
263 | 263 | self.authenticate()
|
264 | 264 | jsonpost = {"sessionCode": self.session_id}
|
265 | 265 | result = requests.post(
|
266 |
| - ARISTA_SOFTWARE_FOLDER_TREE, data=json.dumps(jsonpost), timeout=self.timeout |
| 266 | + ARISTA_SOFTWARE_FOLDER_TREE, |
| 267 | + data=json.dumps(jsonpost), |
| 268 | + timeout=self.timeout, |
| 269 | + headers=REQUEST_HEADERS, |
267 | 270 | )
|
268 | 271 | try:
|
269 | 272 | folder_tree = result.json()["data"]["xml"]
|
@@ -332,7 +335,10 @@ def _get_url(self, remote_file_path: str) -> str:
|
332 | 335 | self.authenticate()
|
333 | 336 | jsonpost = {"sessionCode": self.session_id, "filePath": remote_file_path}
|
334 | 337 | result = requests.post(
|
335 |
| - ARISTA_DOWNLOAD_URL, data=json.dumps(jsonpost), timeout=self.timeout |
| 338 | + ARISTA_DOWNLOAD_URL, |
| 339 | + data=json.dumps(jsonpost), |
| 340 | + timeout=self.timeout, |
| 341 | + headers=REQUEST_HEADERS, |
336 | 342 | )
|
337 | 343 | if "data" in result.json() and "url" in result.json()["data"]:
|
338 | 344 | # logger.debug('URL to download file is: {}', result.json())
|
@@ -421,7 +427,10 @@ def authenticate(self) -> bool:
|
421 | 427 | jsonpost = {"accessToken": credentials}
|
422 | 428 |
|
423 | 429 | result = requests.post(
|
424 |
| - session_code_url, data=json.dumps(jsonpost), timeout=self.timeout |
| 430 | + session_code_url, |
| 431 | + data=json.dumps(jsonpost), |
| 432 | + timeout=self.timeout, |
| 433 | + headers=REQUEST_HEADERS, |
425 | 434 | )
|
426 | 435 |
|
427 | 436 | if result.json()["status"]["message"] in [
|
|
0 commit comments