diff --git a/libnotices.py b/libnotices.py index b2f09a8..10c2078 100644 --- a/libnotices.py +++ b/libnotices.py @@ -17,14 +17,13 @@ class libaccount(dict): def toJson(self): return json.dumps(self,default=lambda o: o.__dict__) class book(): - def __init__(self,itemid,renewalcount,checkoutdate,duedate,vendor,resourceid,resourceinstanceid,title,materialtype,coverurl,person,authsession,renewresult,overdue,isbn): + def __init__(self,itemid,renewalcount,checkoutdate,duedate,vendor,resourceid,title,materialtype,coverurl,person,authsession,renewresult,overdue,isbn): self.id=itemid self.renewalcount=renewalcount self.checkoutdate=checkoutdate self.duedate=duedate self.vendor=vendor self.resourceid=resourceid - self.resourceinstanceid=resourceinstanceid self.title=title self.materialtype=materialtype self.coverurl=coverurl @@ -138,6 +137,10 @@ for myaccount in accounts: myisbn = mybook['resource']['coverUrl']['small'].split('=')[1].split("/")[0] except: myisbn='' + try: + mycoverurl = mybook['resource']['coverUrl']['small'] + except: + mycoverurl = '' duedate = datetime.datetime.strptime(mybook['dueDate'].split('T')[0],'%Y-%m-%d').date() if datetime.date.today() > duedate: overdue=True @@ -151,10 +154,9 @@ for myaccount in accounts: duedate, mybook['vendor'], mybook['resource']['id'], - mybook['resource']['instanceId'], mybook['resource']['title'], mybook['resource']['materialType'], - mybook['resource']['coverUrl']['small'], + mycoverurl, account.name, session, 'None', @@ -167,7 +169,6 @@ for myaccount in accounts: mediatypes.append(thisbook.materialtype) except Exception as e: print(e,mybook) - allbooks.append(thisbook) for book in allbooks: #print(datetime.date.today(),book.duedate) @@ -188,8 +189,7 @@ TD {border-width: 1px; padding: 3px; border-style: solid; border-color: black;} tableend=" " timezone = ZoneInfo("America/Chicago") returntable="Last Updated" + str(datetime.datetime.now(timezone)) -returntable+='
Click Here to be able to refresh the list.' -returntable+='
Click for the return list' +returntable+='
Click Here to visit the site.' returntable += """
@@ -277,8 +277,6 @@ else: for item in returnlist: returntable += "" + item.person + td + item.materialtype + td + str(item.renewalcount) + td + str(item.checkoutdate) + td + str(item.duedate) + td + item.title + td + item.isbn + td +'' +"\n" returntable += tableend -with open("/var/www/html/returnlist.html","w",encoding='utf-8') as outhtml: - outhtml.write(returntable) htmltable = returntable with open("/var/www/html/index.html","w",encoding='utf-8') as outhtml: outhtml.write(htmltable)