Dolda2000 GitWeb
/
automanga.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1e88082
)
getmanga: Introduce a bit of retry logic in opening pages.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Mon, 27 Jul 2020 12:04:28 +0000
(14:04 +0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Mon, 27 Jul 2020 12:04:28 +0000
(14:04 +0200)
getmanga
patch
|
blob
|
blame
|
history
diff --git
a/getmanga
b/getmanga
index
aa83359
..
3ea50d3
100755
(executable)
--- a/
getmanga
+++ b/
getmanga
@@
-117,7
+117,20
@@
def download(mng, tdir, pattern):
msg(2, "%s exists, skipping", nm)
continue
msg(1, "getting %s...", nm)
msg(2, "%s exists, skipping", nm)
continue
msg(1, "getting %s...", nm)
- with page.open() as fp:
+ retries = 0
+ while True:
+ try:
+ fp = page.open()
+ break
+ except OSError as error:
+ if retries < 5:
+ sys.stderr.write("getmanga: warning: error when getting %s: %s\n" % (nm, error))
+ retries += 1
+ time.sleep(60)
+ else:
+ sys.stderr.write("getmanga: error when getting %s: %s\n" % (nm, error))
+ sys.exit(1)
+ with fp:
with open(path, "wb") as out:
done = False
try:
with open(path, "wb") as out:
done = False
try: