Last active
December 10, 2015 10:38
-
-
Save lawlesst/4422229 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from illiad.account import IlliadSession | |
#Establish an ILLiad session for a given user. | |
ill = IlliadSession('https://illiad.school.edu', | |
'your secret remote auth header', | |
'libraryusername') | |
#Log the user in. | |
ill.login() | |
#An OpenURL for the item to be requested. In this case an article. | |
openurl = """ | |
rft.jtitle=Facial plastic surgery : FPS&rft.atitle=Anatomy for blepharoplasty and brow-lift.&rft.pages=177-85&rft.date=2010&rft.volume=26&rft.end_page=85&ctx_ver=Z39.88-2004&rft.genre=article | |
""" | |
#Get the ILLiad request key for this item. | |
#This is found by issuing a GET request for the OpenURL and parsing | |
#the returned web form. | |
request_key = ill.get_request_key(openurl) | |
#Submit the request by posting the values to ILLiad. | |
submitted = ill.make_request(request_key) | |
#If all goes well, you will get a transaction number for the submission. | |
print submitted.get('transaction_number') | |
#If there is an error, a description of the error will be returned. | |
print submitted.get('message') | |
#Log the user out. | |
ill.logout() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment