only use pleroma mode if 'prev' key exists, handle final page better
This commit is contained in:
parent
7d718bbe3a
commit
fbde3cb911
1 changed files with 3 additions and 1 deletions
4
main.py
4
main.py
|
@ -193,7 +193,7 @@ for f in following:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
pleroma = False
|
pleroma = False
|
||||||
if 'next' not in j:
|
if 'next' not in j and 'prev' in j:
|
||||||
print("Using Pleroma compatibility mode")
|
print("Using Pleroma compatibility mode")
|
||||||
pleroma = True
|
pleroma = True
|
||||||
j = j['first']
|
j = j['first']
|
||||||
|
@ -243,6 +243,8 @@ for f in following:
|
||||||
r = requests.get(j['next'], timeout=15)
|
r = requests.get(j['next'], timeout=15)
|
||||||
except requests.Timeout:
|
except requests.Timeout:
|
||||||
print("HTTP timeout, site did not respond within 15 seconds")
|
print("HTTP timeout, site did not respond within 15 seconds")
|
||||||
|
except KeyError:
|
||||||
|
print("Couldn't get next page - we've probably got all the posts")
|
||||||
except:
|
except:
|
||||||
print("An error occurred while trying to obtain more posts.")
|
print("An error occurred while trying to obtain more posts.")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue