1
0
Fork 0

Adding upstream version 0.10.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-05 13:51:25 +01:00
parent ac8cf99bdd
commit 160b3093ed
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
4 changed files with 26 additions and 12 deletions

View file

@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: ["3.8", "3.9", "3.10"] python-version: ["3.8", "3.9", "3.10", "3.11"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
@ -27,7 +27,7 @@ jobs:
needs: [pre-commit] needs: [pre-commit]
strategy: strategy:
matrix: matrix:
python-version: ["3.8", "3.9", "3.10"] python-version: ["3.8", "3.9", "3.10", "3.11"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -55,7 +55,7 @@ jobs:
strategy: strategy:
matrix: matrix:
python: ["3.8", "3.9", "3.10"] python: ["3.8", "3.9", "3.10", "3.11"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -78,7 +78,7 @@ jobs:
strategy: strategy:
matrix: matrix:
python: ["3.8", "3.9", "3.10"] python: ["3.8", "3.9", "3.10", "3.11"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -101,7 +101,7 @@ jobs:
strategy: strategy:
matrix: matrix:
python: ["3.8", "3.9", "3.10"] python: ["3.8", "3.9", "3.10", "3.11"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View file

@ -26,6 +26,11 @@ from rich.progress import (
console = rich.get_console() console = rich.get_console()
done_event = Event() done_event = Event()
REQUEST_HEADERS = {
"Content-Type": "application/json",
"User-Agent": "Chrome/123.0.0.0",
}
def handle_sigint(signum: Any, frame: Any) -> None: def handle_sigint(signum: Any, frame: Any) -> None:
"""Progress bar handler""" """Progress bar handler"""
@ -64,7 +69,7 @@ class DownloadProgressBar:
self, task_id: TaskID, url: str, path: str, block_size: int = 1024 self, task_id: TaskID, url: str, path: str, block_size: int = 1024
) -> bool: ) -> bool:
"""Copy data from a url to a local file.""" """Copy data from a url to a local file."""
response = requests.get(url, stream=True, timeout=5) response = requests.get(url, stream=True, timeout=5, headers=REQUEST_HEADERS)
# This will break if the response doesn't contain content length # This will break if the response doesn't contain content length
self.progress.update(task_id, total=int(response.headers["Content-Length"])) self.progress.update(task_id, total=int(response.headers["Content-Length"]))
with open(path, "wb") as dest_file: with open(path, "wb") as dest_file:

View file

@ -40,7 +40,7 @@ from eos_downloader import (
MSG_TOKEN_EXPIRED, MSG_TOKEN_EXPIRED,
) )
from eos_downloader.data import DATA_MAPPING from eos_downloader.data import DATA_MAPPING
from eos_downloader.download import DownloadProgressBar from eos_downloader.download import DownloadProgressBar, REQUEST_HEADERS
# logger = logging.getLogger(__name__) # logger = logging.getLogger(__name__)
@ -263,7 +263,10 @@ class ObjectDownloader:
self.authenticate() self.authenticate()
jsonpost = {"sessionCode": self.session_id} jsonpost = {"sessionCode": self.session_id}
result = requests.post( result = requests.post(
ARISTA_SOFTWARE_FOLDER_TREE, data=json.dumps(jsonpost), timeout=self.timeout ARISTA_SOFTWARE_FOLDER_TREE,
data=json.dumps(jsonpost),
timeout=self.timeout,
headers=REQUEST_HEADERS,
) )
try: try:
folder_tree = result.json()["data"]["xml"] folder_tree = result.json()["data"]["xml"]
@ -332,7 +335,10 @@ class ObjectDownloader:
self.authenticate() self.authenticate()
jsonpost = {"sessionCode": self.session_id, "filePath": remote_file_path} jsonpost = {"sessionCode": self.session_id, "filePath": remote_file_path}
result = requests.post( result = requests.post(
ARISTA_DOWNLOAD_URL, data=json.dumps(jsonpost), timeout=self.timeout ARISTA_DOWNLOAD_URL,
data=json.dumps(jsonpost),
timeout=self.timeout,
headers=REQUEST_HEADERS,
) )
if "data" in result.json() and "url" in result.json()["data"]: if "data" in result.json() and "url" in result.json()["data"]:
# logger.debug('URL to download file is: {}', result.json()) # logger.debug('URL to download file is: {}', result.json())
@ -421,7 +427,10 @@ class ObjectDownloader:
jsonpost = {"accessToken": credentials} jsonpost = {"accessToken": credentials}
result = requests.post( result = requests.post(
session_code_url, data=json.dumps(jsonpost), timeout=self.timeout session_code_url,
data=json.dumps(jsonpost),
timeout=self.timeout,
headers=REQUEST_HEADERS,
) )
if result.json()["status"]["message"] in [ if result.json()["status"]["message"] in [

View file

@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "eos_downloader" name = "eos_downloader"
version = "v0.10.0" version = "v0.10.1"
readme = "README.md" readme = "README.md"
authors = [{ name = "Thomas Grimonet", email = "thomas.grimonet@gmail.com" }] authors = [{ name = "Thomas Grimonet", email = "thomas.grimonet@gmail.com" }]
maintainers = [ maintainers = [
@ -94,7 +94,7 @@ namespaces = false
# Version # Version
################################ ################################
[tool.bumpver] [tool.bumpver]
current_version = "0.10.0" current_version = "0.10.1"
version_pattern = "MAJOR.MINOR.PATCH" version_pattern = "MAJOR.MINOR.PATCH"
commit_message = "bump: Version {old_version} -> {new_version}" commit_message = "bump: Version {old_version} -> {new_version}"
commit = true commit = true