Python wrappers above cern-get-sso-cookie.
- You have cern-get-sso-cookie on your system installed
- You have your CERN user certificate in some secure directory named
from cernsso.cookie import CookieManager # Directory should contain myCert.pem, myCert.key and be writable m = CookieManager("/your/private/directory") url = "http://eindex.cern.ch/" # This cookie should be used with your http requests cookies = m.get_cookie(url) import requests r = requests.get(url, cookies=cookies) # probably will fail without export REQUESTS_CA_BUNDLE=/etc/ssl/certs/CERNGridCertificationAuthority.pem
m.get_cookie does load cached cookie, if it was obtained in last 24-hours. To force-obtain cookie one should use
All cookies are stored in sqlite storage inside working directory