mirror of
https://github.com/Garmelon/PFERD.git
synced 2026-04-12 15:35:05 +02:00
Make Ti downloader authentication more robust
This commit is contained in:
parent
44b4204517
commit
c72e92db18
1 changed files with 9 additions and 3 deletions
12
PFERD/ti.py
12
PFERD/ti.py
|
|
@ -105,6 +105,12 @@ class Ti:
|
||||||
self._credentials = None
|
self._credentials = None
|
||||||
|
|
||||||
def _download(self, url, to_path):
|
def _download(self, url, to_path):
|
||||||
username, password = self._get_credentials()
|
while True:
|
||||||
with self._session.get(url, stream=True, auth=(username, password)) as r:
|
username, password = self._get_credentials()
|
||||||
stream_to_path(r, to_path)
|
with self._session.get(url, stream=True, auth=(username, password)) as r:
|
||||||
|
if r.ok:
|
||||||
|
stream_to_path(r, to_path)
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
print("Incorrect credentials.")
|
||||||
|
self._reset_credentials()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue