https://github.com/sashabaranov/cernsso
Python wrappers above cern-get-sso-cookie
https://github.com/sashabaranov/cernsso
Last synced: 3 months ago
JSON representation
Python wrappers above cern-get-sso-cookie
- Host: GitHub
- URL: https://github.com/sashabaranov/cernsso
- Owner: sashabaranov
- License: apache-2.0
- Created: 2015-05-20T13:29:22.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-06T12:07:11.000Z (over 9 years ago)
- Last Synced: 2025-02-12T13:59:07.659Z (4 months ago)
- Language: Python
- Size: 157 KB
- Stars: 0
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cern-sso
Python wrappers above cern-get-sso-cookie.Assumptions are:
* You have cern-get-sso-cookie on your system installed
* You have your CERN user certificate in some secure directory named `myCert.pem` and `myCert.key`Basic usage:
```python
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
```The `m.get_cookie` does load cached cookie, if it was obtained in last 24-hours. To force-obtain cookie one should use `m.get_new_cookie`.
All cookies are stored in sqlite storage inside working directory `"/your/private/directory"`