mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
u2cli: better error messages
This commit is contained in:
parent
1a8dc3d18a
commit
f6c7e49eb8
12
bin/up2k.py
12
bin/up2k.py
|
@ -3,7 +3,7 @@ from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
"""
|
"""
|
||||||
up2k.py: upload to copyparty
|
up2k.py: upload to copyparty
|
||||||
2021-11-16, v0.12, ed <irc.rizon.net>, MIT-Licensed
|
2021-11-28, v0.13, ed <irc.rizon.net>, MIT-Licensed
|
||||||
https://github.com/9001/copyparty/blob/hovudstraum/bin/up2k.py
|
https://github.com/9001/copyparty/blob/hovudstraum/bin/up2k.py
|
||||||
|
|
||||||
- dependencies: requests
|
- dependencies: requests
|
||||||
|
@ -390,7 +390,7 @@ def handshake(req_ses, url, file, pw, search):
|
||||||
r = req_ses.post(url, headers=headers, json=req)
|
r = req_ses.post(url, headers=headers, json=req)
|
||||||
break
|
break
|
||||||
except:
|
except:
|
||||||
eprint("handshake failed, retry...\n")
|
eprint("handshake failed, retrying: {0}\n".format(file.name))
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -470,11 +470,11 @@ class Ctl(object):
|
||||||
nbytes += inf.st_size
|
nbytes += inf.st_size
|
||||||
|
|
||||||
if err:
|
if err:
|
||||||
eprint("\n# failed to access {} paths:\n".format(len(err)))
|
eprint("\n# failed to access {0} paths:\n".format(len(err)))
|
||||||
for x in err:
|
for x in err:
|
||||||
eprint(x.decode("utf-8", "replace") + "\n")
|
eprint(x.decode("utf-8", "replace") + "\n")
|
||||||
|
|
||||||
eprint("^ failed to access those {} paths ^\n\n".format(len(err)))
|
eprint("^ failed to access those {0} paths ^\n\n".format(len(err)))
|
||||||
if not ar.ok:
|
if not ar.ok:
|
||||||
eprint("aborting because --ok is not set\n")
|
eprint("aborting because --ok is not set\n")
|
||||||
return
|
return
|
||||||
|
@ -505,7 +505,7 @@ class Ctl(object):
|
||||||
print("{0} {1}\n hash...".format(self.nfiles - nf, upath))
|
print("{0} {1}\n hash...".format(self.nfiles - nf, upath))
|
||||||
get_hashlist(file, None)
|
get_hashlist(file, None)
|
||||||
|
|
||||||
burl = self.ar.url[:8] + self.ar.url[8:].split("/")[0] + "/"
|
burl = self.ar.url[:12] + self.ar.url[8:].split("/")[0] + "/"
|
||||||
while True:
|
while True:
|
||||||
print(" hs...")
|
print(" hs...")
|
||||||
hs = handshake(req_ses, self.ar.url, file, self.ar.a, search)
|
hs = handshake(req_ses, self.ar.url, file, self.ar.a, search)
|
||||||
|
@ -773,7 +773,7 @@ class Ctl(object):
|
||||||
try:
|
try:
|
||||||
upload(req_ses, file, cid, self.ar.a)
|
upload(req_ses, file, cid, self.ar.a)
|
||||||
except:
|
except:
|
||||||
eprint("upload failed, retry...\n")
|
eprint("upload failed, retrying: {0} #{1}\n".format(file.name, cid[:8]))
|
||||||
pass # handshake will fix it
|
pass # handshake will fix it
|
||||||
|
|
||||||
with self.mutex:
|
with self.mutex:
|
||||||
|
|
Loading…
Reference in a new issue