summaryrefslogtreecommitdiffstats
path: root/gather.py
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-11-08 11:12:40 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2022-11-08 11:12:40 +0100
commitcbdfbd51e31a07ee8e4c37b32a141c85d4b32384 (patch)
treea1d2e710b710fcf0bdfb49a8ee034f4faae16507 /gather.py
parenttransaction element can differ from format, as in 1023622 (diff)
downloadbiblos-stat-cbdfbd51e31a07ee8e4c37b32a141c85d4b32384.tar
biblos-stat-cbdfbd51e31a07ee8e4c37b32a141c85d4b32384.tar.gz
biblos-stat-cbdfbd51e31a07ee8e4c37b32a141c85d4b32384.tar.bz2
biblos-stat-cbdfbd51e31a07ee8e4c37b32a141c85d4b32384.tar.lz
biblos-stat-cbdfbd51e31a07ee8e4c37b32a141c85d4b32384.tar.xz
biblos-stat-cbdfbd51e31a07ee8e4c37b32a141c85d4b32384.tar.zst
biblos-stat-cbdfbd51e31a07ee8e4c37b32a141c85d4b32384.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 795c409..5950363 100755
--- a/gather.py
+++ b/gather.py
@@ -24,7 +24,7 @@ Base = declarative_base()
class Book(Base):
__tablename__ = "books"
- isbn = Column(BigInteger, primary_key=True, nullable=False, doc="book isbn. found in URL http://www/isbn/987 and in acsm: resource, dc:identifier (sometimes not), thumbnailURL")
+ isbn = Column(BigInteger, primary_key=True, nullable=False, doc="book isbn. found in URL http://www/isbn/978 and in acsm: resource, dc:identifier (sometimes not), thumbnailURL")
title = Column(String, nullable=True, doc="title of the book, dcc:title in acsm")
creator = Column(String, nullable=True, doc="author of the book, dc:creator in acsm")
publisher = Column(String, nullable=True, doc="publisher of the book, dc:publisher in acsm")
@@ -98,8 +98,8 @@ try:
elif r.text.startswith("Napaka pri prenosu"):
logger.warning(f"'napaka pri prenosu' received from http for acsm id {acsm_id}, skipping")
force_acsm_id = acsm_id+1
- 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)
+ elif r.text.startswith('<error xmlns="http://ns.adobe.com/adept" data="E_URLLINK_NO_SUCH_RESOURCE resid urn:uuid:00000000-1002-0000-0009-') or r.text.startswith('<error xmlns="http://ns.adobe.com/adept" data="E_URLLINK_NO_DISTRIBUTION_RIGHTS urn:uuid:00000000-1002-0000-0009-'):
+ isbn = int([x for x in r.text.split() if x.startswith("urn:uuid:00000000-1002-0000-0009-")][0].split("-").pop())+int(9e12)
borrow = Borrow(id=acsm_id, isbn=isbn, obtained=int(time()))
logger.warning(f"received either 'no such resource' or 'no distribution rights' from server and stored a quite empty {borrow}")
session.add(borrow)