{ "info": { "author": "Peter Stein", "author_email": "peter.stein@cern.ch", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)" ], "description": "[![Build Status](https://travis-ci.com/ptrstn/cernrequests.svg?branch=master)](https://travis-ci.com/ptrstn/cernrequests)\n[![](https://img.shields.io/pypi/v/cernrequests.svg)](https://pypi.org/project/cernrequests/)\n\n\n# CERN Requests\n\nEnables using [requests](\"https://github.com/requests/requests\") without having to configure the CERN Root certificates.\n\nInspired by [certifi](https://github.com/certifi/python-certifi), [requests-kerberos](https://github.com/requests/requests-kerberos) and [cern-sso-python](https://github.com/cerndb/cern-sso-python)\n\nThe Root certificate bundle is copied from the [linuxsoft cern page](http://linuxsoft.cern.ch/cern/centos/7/cern/x86_64/repoview/CERN-CA-certs.html) and can also be created manually by downloading the CERN Grid Certification Authority files from [cafiles.cern.ch/cafiles](https://cafiles.cern.ch/cafiles/).\n\n## Installation\n\nRequires ```Python 2.7``` or ```Python 3.4+```\n\n```bash\npip install cernrequests\n```\n\n## Prerequisites\n\nRequest a [Grid User Certificate](https://ca.cern.ch/ca/) and convert into public and private key:\n\n```bash\nmkdir -p ~/private\nopenssl pkcs12 -clcerts -nokeys -in myCertificate.p12 -out ~/private/usercert.pem\nopenssl pkcs12 -nocerts -in myCertificate.p12 -out ~/private/userkey.tmp.pem\nopenssl rsa -in ~/private/userkey.tmp.pem -out ~/private/userkey.pem\n```\n\nThe certificates have to be **passwordless**.\n\n## Usage\n\n### Example\n\n```python\nimport cernrequests\n\nurl = \"https://\"\nresponse = cernrequests.get(url)\n```\n\n### Cookies Example\n\nIf you want to access a website which requires CERN Single Sign-on cookies you can do the following:\n\n```python\nimport cernrequests\n\nurl = \"https://\"\ncookies = cernrequests.get_sso_cookies(url)\nresponse = cernrequests.get(url, cookies=cookies)\n```\n\n### Alternative usage\n\nIf you want to use ```requests``` directly without the CERN wrapper you can get the exact same functionality by doing:\n\n```python\nimport requests\nfrom cernrequests import certs\n\nurl = \"https://\"\ncert = certs.default_user_certificate_paths()\nca_bundle = certs.where()\n\nresponse = requests.get(url, cert=cert, verify=ca_bundle)\n```\n\n## Configuration\n\nThe default user certificate paths are first ```~\\private\\``` and ```~\\.globus\\``` for fallback. The default *public* key file name is ```usercert.pem``` and the default *private* key file name is ```userkey.pem```\n\nYou can configure the default grid user certificate path by setting the ```CERN_CERTIFICATE_PATH``` environment variable.\n\nFor example:\n\n```bash\nexport CERN_CERTIFICATE_PATH=${HOME}/my_custom_folder\n```\n\nThis will still assume that your filenames are ```usercert.pem``` and ```userkey.pem```\nWrite this line in your ```.bashrc``` to make the configuration persistent.\n\nAlternatively you can also specify the paths directly in your code:\n\n```python\nimport cernrequests\n\nurl = \"https://\"\ncert = \"my/custom/path/cert.pem\" # Public key path\nkey = \"my/custom/path/key.pem\" # Private key path\n\ncernrequests.get(url, cert=(cert,key))\n```\n\nThis way you can even use custom names such as ```cert.pem``` and ```key.pem```\n\n## References\n\n- http://docs.python-requests.org/en/master/\n- https://certifi.io/en/latest/\n- https://github.com/cerndb/cern-sso-python\n- https://linux.web.cern.ch/linux/docs/cernssocookie.shtml\n- http://linuxsoft.cern.ch/cern/centos/7/cern/x86_64/repoview/CERN-CA-certs.html\n- https://ca.cern.ch/ca/\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ptrstn/cernrequests", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "cernrequests", "package_url": "https://pypi.org/project/cernrequests/", "platform": "", "project_url": "https://pypi.org/project/cernrequests/", "project_urls": { "Homepage": "https://github.com/ptrstn/cernrequests" }, "release_url": "https://pypi.org/project/cernrequests/0.3.0/", "requires_dist": [ "requests", "future" ], "requires_python": "", "summary": "", "version": "0.3.0" }, "last_serial": 5118904, "releases": { "0.1.3": [ { "comment_text": "", "digests": { "md5": "e48693233d6ebf4e12b7fa142d672001", "sha256": "4a8b3e882d58200bac5d3af863bac6dca29d5e182173ee6229c71ba2ea61ebda" }, "downloads": -1, "filename": "cernrequests-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "e48693233d6ebf4e12b7fa142d672001", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17870, "upload_time": "2018-12-17T19:11:39", "url": "https://files.pythonhosted.org/packages/02/b6/027cc93ad416b406e66222ec345b5e32b0c9cce6a1593263dd579763a114/cernrequests-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e1034fc56fedd796f7e14775a0b5b04b", "sha256": "0e01b6f49494f505d4deab6e2ec0536a04b04c5371b1296c1608deef480e4446" }, "downloads": -1, "filename": "cernrequests-0.1.3.tar.gz", "has_sig": false, "md5_digest": "e1034fc56fedd796f7e14775a0b5b04b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14201, "upload_time": "2018-12-17T19:11:56", "url": "https://files.pythonhosted.org/packages/2c/38/ef4bc3d77d74861ce5fa623050da9b3c416d4148a2e5de9f725ae1000fea/cernrequests-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "6473941ff140b2b4fc12cc35885846d0", "sha256": "c6bf05488de64abf0c39c7479efb60f53d0fdae17c17a654571118607e92e5b6" }, "downloads": -1, "filename": "cernrequests-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6473941ff140b2b4fc12cc35885846d0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18312, "upload_time": "2019-01-07T13:28:57", "url": "https://files.pythonhosted.org/packages/3b/71/c9e941dcf97119b0813fee905696024d2bf74cd8ddba1e28c6ce45400075/cernrequests-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "61974039f0e261d69002f7da92466ea5", "sha256": "8a4b6ad7baaea7a66a638475cb94bc75db1fd8ab1120b0abb7d622444c652a4a" }, "downloads": -1, "filename": "cernrequests-0.2.0.tar.gz", "has_sig": false, "md5_digest": "61974039f0e261d69002f7da92466ea5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15479, "upload_time": "2019-01-07T13:28:59", "url": "https://files.pythonhosted.org/packages/ab/82/4ed9abac445014ca4c2c7207767fd3d0d9ca469ae487bd2bacb11956be83/cernrequests-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "705f2f912cfc4f5e071f21a1720aa1dd", "sha256": "e0e8ea74d4dbbafb0a48eaaae0375b7ca84f675bf8a2204c4f4ca104ce874b02" }, "downloads": -1, "filename": "cernrequests-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "705f2f912cfc4f5e071f21a1720aa1dd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18347, "upload_time": "2019-04-09T14:00:23", "url": "https://files.pythonhosted.org/packages/9f/33/4039b90fccf839ac80681503ff43c190cfb59fb9504b8420d5acd4d85874/cernrequests-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "961b82c2a134ada344fcea334f76e696", "sha256": "64414a20818cc08705627bb658391123634fc7203bd62e1ed845f65e96bf31ee" }, "downloads": -1, "filename": "cernrequests-0.3.0.tar.gz", "has_sig": false, "md5_digest": "961b82c2a134ada344fcea334f76e696", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15501, "upload_time": "2019-04-09T14:00:25", "url": "https://files.pythonhosted.org/packages/c2/57/3249327ef5169268357b0f8ba3c42cda9ede53e0667512ce18ebf10d02c3/cernrequests-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "705f2f912cfc4f5e071f21a1720aa1dd", "sha256": "e0e8ea74d4dbbafb0a48eaaae0375b7ca84f675bf8a2204c4f4ca104ce874b02" }, "downloads": -1, "filename": "cernrequests-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "705f2f912cfc4f5e071f21a1720aa1dd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18347, "upload_time": "2019-04-09T14:00:23", "url": "https://files.pythonhosted.org/packages/9f/33/4039b90fccf839ac80681503ff43c190cfb59fb9504b8420d5acd4d85874/cernrequests-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "961b82c2a134ada344fcea334f76e696", "sha256": "64414a20818cc08705627bb658391123634fc7203bd62e1ed845f65e96bf31ee" }, "downloads": -1, "filename": "cernrequests-0.3.0.tar.gz", "has_sig": false, "md5_digest": "961b82c2a134ada344fcea334f76e696", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15501, "upload_time": "2019-04-09T14:00:25", "url": "https://files.pythonhosted.org/packages/c2/57/3249327ef5169268357b0f8ba3c42cda9ede53e0667512ce18ebf10d02c3/cernrequests-0.3.0.tar.gz" } ] }