summaryrefslogtreecommitdiffstats
path: root/gather.py
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-11-06 20:45:12 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2022-11-06 20:45:12 +0100
commitcf74243d9ac67916a0739a51f158ca96957bd28e (patch)
treefb5124e5ca196db96a5d5494012de29d09071fb0 /gather.py
parentoverrode requests' 'educated' encoding guesses (diff)
downloadbiblos-stat-cf74243d9ac67916a0739a51f158ca96957bd28e.tar
biblos-stat-cf74243d9ac67916a0739a51f158ca96957bd28e.tar.gz
biblos-stat-cf74243d9ac67916a0739a51f158ca96957bd28e.tar.bz2
biblos-stat-cf74243d9ac67916a0739a51f158ca96957bd28e.tar.lz
biblos-stat-cf74243d9ac67916a0739a51f158ca96957bd28e.tar.xz
biblos-stat-cf74243d9ac67916a0739a51f158ca96957bd28e.tar.zst
biblos-stat-cf74243d9ac67916a0739a51f158ca96957bd28e.zip
Diffstat (limited to 'gather.py')
-rwxr-xr-xgather.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/gather.py b/gather.py
index 77c6521..e656b03 100755
--- a/gather.py
+++ b/gather.py
@@ -93,10 +93,10 @@ try:
if acsm_id < guaranteed_large_acsm_id:
logger.error(f"this shouldn't happen. I have a hardcoded value that tells me that at time of program writing, acsm id {guaranteed_large_acsm_id} did exist on the server. dying anyways.")
break
- elif r.text.startswith('<error xmlns="http://ns.adobe.com/adept" data="E_URLLINK_NO_SUCH_RESOURCE resid urn:uuid:00000000-1002-0000-0009-78'):
- isbn = int(r.text.split()[4].split("-").pop())+int(9e12)
+ elif r.text.startswith('<error xmlns="http://ns.adobe.com/adept" data="E_URLLINK_NO_SUCH_RESOURCE resid urn:uuid:00000000-1002-0000-0009-78') or r.text.startswith('<error xmlns="http://ns.adobe.com/adept" data="E_URLLINK_NO_DISTRIBUTION_RIGHTS urn:uuid:00000000-1002-0000-0009-78'):
+ isbn = int([x for x in r.text.split() if x.startswith("urn:uuid:00000000-1002-0000-0009-78")][0].split("-").pop())+int(9e12)
borrow = Borrow(id=acsm_id, isbn=isbn, obtained=int(time()))
- logger.warning(f"received 'no such resource' from server and stored a quite empty {borrow}")
+ logger.warning(f"received either 'no such resource' or 'no distribution rights' from server and stored a quite empty {borrow}")
session.add(borrow)
session.commit()
only_isbn_acsms += 1