{ "info": { "author": "Jon Mason", "author_email": "jon@conjur.net", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7" ], "description": "# Conjur Python2 API Client\n\nA Python2 client for the Conjur API.\n\n**If you are looking for Python3 API client, please go to our new project page at https://github.com/cyberark/conjur-api-python3.**\n\n**IMPORTANT: THIS API CLIENT IS NOT CURRENTLY ACTIVELY BEING SUPPORTED**\n\n## Installation\n\nThis Conjur Python2 API requires Python 2.7. \n\nInstall from [PyPI](https://pypi.python.org/pypi/Conjur)\n\n```\npip install conjur\n```\n\n**Note:** If you have the `pandoc` package installed you may need to uninstall it for the above command to work. You\ncan do so with `pip uninstall pypandoc`.\n\n## API Documentation\n\nSee the [API documentation](https://conjurinc.github.io/api-python) for details\nof all classes and methods.\n\n\n## Usage\n\n### Configuration\n\n```python\n# The `config` member of the conjur.config module is a \"global\" Configuration\n# used by new API instances by default.\nfrom conjur.config import config\n\n# Set the conjur appliance url. This can also be provided\n# by the CONJUR_APPLIANCE_URL environment variable.\nconfig.appliance_url = 'https://conjur.example.com/api'\n\n# Set the (PEM) certificate file. This is also configurable with the\n# CONJUR_CERT_FILE environment variable.\nconfig.cert_file = '/path/to/conjur-account.pem'\n```\n\n### Creating and Using an API Instance\n\n```python\nimport conjur\n\n# For God's sake, don't put passwords in your source code!\npassword = 'super-secret'\nlogin = 'alice'\n\n# Create an API instance that can perform actions as the user 'alice'\napi = conjur.new_from_key(login, password)\n\n# Use the API to fetch the value of a variable\n\nsecret = api.variable('my-secret').value()\n\nprint(\"The secret is '{}'\".format(secret))\n\n```\n\n`new_from_key` accepts a Conjur username and an api_key or password\n([see the Conjur developer documentation](http://developer.conjur.net/reference/services/authentication/authenticate.html) for details about the distinction). This is useful if your script is authenticating as an particular Conjur identity rather than acting on behalf of a user who has provided their token.\n\nWhen created using this method, the API will attempt to authenticate the first time a method requiring\nauthorization is called. To force it to authenticate immediately, you can use the `authenticate()` method.\nAn instance created with `new_from_key` will cache it's auth token indefinitely.\nSince Conjur auth tokens expire after 8 minutes, you can force an api instance to update its token\nby calling `api.authenticate(cached=False)` or by setting `api.token = None`.\n\n\n\n### Other Ways to Create an API Instance\n\nIf the host running your application has been assigned a Conjur identity\n`new_from_netrc` is the easiest way to create an API instance.\n\n```python\nimport conjur\nfrom conjur.config import config\n\nconfig.load('/etc/conjur.conf')\napi = conjur.new_from_netrc('/etc/conjur.identity', config=config)\n```\n\n\nIf you have an existing authentication token, for example when handling\nan HTTP request that contains an end user's token, use `new_from_token` to create your API instance.\n\n```python\nimport conjur\n# ... some web magic\n\napi = conjur.new_from_token(request.get_json()['user_token'])\nsalesforce_apikey = api.variable('sales/salesforce/api_key')\n```\n\n### YAML file\n\nConjurized hosts will have this file placed at `/etc/conjur.conf`.\n\nRunning locally this will be your `~/.conjurrc` file.\n\n```python\nfrom conjur.config import config\n\nconfig.load('/etc/conjur.conf')\n```\n\n### Variables\n\nYou can create, fetch and update variables like so:\n\n```python\nimport os\nimport conjur\n\napi = conjur.new_from_key(login='danny', api_key=os.getenv('CONJUR_API_KEY'))\n\nloggly_token = api.create_variable(\n id='monitoring/loggly.com/api-token',\n value='dEet7Hib1oSh9g'\n)\n\ngis_database_password = api.variable('gis/postgres/password')\nprint(gis_database_password.value())\n\ngis_database_password.add_value('lij6det8eJ7pIx')\n```\n\nIf no `id` is given, a unique id will be generated. If a value is provided, it will\nbe used to set the variable's initial value. When fetching a variable, you can pass\na `version` keyword argument to `value()` to retrieve a specific version.\n\n\n### Users\n\nCreate a user `alice` with password `super-secret`.\n\n```python\nalice = api.create_user('alice', password='super-secret')\n```\n\nCreate a user `bob` without a password, and save the API key. When creating\na Conjur user, the API is available in the response. However, retrieving the\nuser in the future **will not** return the API key.\n\n```python\nbob = api.create_user('bob')\nbob_api_key = bob.api_key\n\nprint(\"Created user 'bob' with api key '{}'\".format(bob_api_key))\n```\n\nFetch a user named 'otto', and check whether or not it was found:\n\n```python\nif api.user('otto').exists():\n print(\"Otto exists!\")\nelse:\n print(\"Sorry, otto doesn't exist :-(\")\n```\n\n\n### Groups\n\nCreate a group named `developers` and add an existing user `alice` to it.\n\n```python\ndevs = api.create_group('developers')\n\n```\n\n\n\n## Development\n\nClone this project and run:\n\n```\npip install -r requirements.txt -r requirements_dev.txt\n```\n\nRun tests and linting with:\n\n```\n./jenkins.sh\n```\n\n### PyPi\n\nTo publish to PyPi, you will need to convert this document to restructured\ntext using pandoc: \n\n```\npandoc --from=markdown --to=rst --output=README.rst README.md\n```\n\nFurthermore, you will likely need to have the `pypandoc` package installed\nfor the markup to appear correctly on the PyPi site. \n\n## License\n\nCopyright 2016-2017 CyberArk\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this software except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\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/conjurinc/api-python", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "Conjur", "package_url": "https://pypi.org/project/Conjur/", "platform": "", "project_url": "https://pypi.org/project/Conjur/", "project_urls": { "Homepage": "https://github.com/conjurinc/api-python" }, "release_url": "https://pypi.org/project/Conjur/0.4.5/", "requires_dist": [ "pyyaml", "requests (>=2.2.1)" ], "requires_python": "<3", "summary": "Python2-only client for the Conjur v4 API", "version": "0.4.5" }, "last_serial": 5283249, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "71cc7d83703d070c2cb7ec8cc875125e", "sha256": "9173860b37c5cf2d690143afc9fb88b69d43ae4ab8c2c8e267d923473fe58040" }, "downloads": -1, "filename": "Conjur-0.3.0.tar.gz", "has_sig": false, "md5_digest": "71cc7d83703d070c2cb7ec8cc875125e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7476, "upload_time": "2014-09-14T08:41:03", "url": "https://files.pythonhosted.org/packages/84/49/8c89b6df80b7d91d6e0a732c117430b6b8891076f37c864255bff440e3f9/Conjur-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "5ebb9c4c9e972f83f4f5f8053292e27d", "sha256": "bdd21e5a2a7c3067506f9746ca3c6d45d65046ce7bd6be99442acaf012a29c5b" }, "downloads": -1, "filename": "Conjur-0.3.1.tar.gz", "has_sig": false, "md5_digest": "5ebb9c4c9e972f83f4f5f8053292e27d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9579, "upload_time": "2015-02-13T16:17:50", "url": "https://files.pythonhosted.org/packages/24/10/b1febca5863a976bfc6fb3a4482e4d02e2e46269f9f385cae17bf88603b9/Conjur-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "58dd7ef9de39daf0b392570530753514", "sha256": "cfa22825a0b756dff822d575426d30db730901b7946d97b45839700334c0dc7a" }, "downloads": -1, "filename": "Conjur-0.3.2.tar.gz", "has_sig": false, "md5_digest": "58dd7ef9de39daf0b392570530753514", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13228, "upload_time": "2015-02-19T23:03:42", "url": "https://files.pythonhosted.org/packages/7d/c9/75d47bccefce67fa37d6c7d764722e0b6aaba5e8b2673575aa8b684765ee/Conjur-0.3.2.tar.gz" } ], "0.4.4": [ { "comment_text": "", "digests": { "md5": "3615fc93bd877208b743edb145498639", "sha256": "61bfd6f343576da926da92400d394c3f7b9669196888e9949005b64736619680" }, "downloads": -1, "filename": "Conjur-0.4.4.tar.gz", "has_sig": false, "md5_digest": "3615fc93bd877208b743edb145498639", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22377, "upload_time": "2016-08-02T22:28:32", "url": "https://files.pythonhosted.org/packages/af/08/6271e8ff18ee37dfdfb4dc828810a6685bc2a2baf706085331989b193c47/Conjur-0.4.4.tar.gz" } ], "0.4.5": [ { "comment_text": "", "digests": { "md5": "b94b3d05c5efb1064a6e6aa702d721de", "sha256": "a4681dc4af0b5b3dea1c0317a1af4e784cde00759598a0aa1d62d030f6b8b768" }, "downloads": -1, "filename": "Conjur-0.4.5-py2-none-any.whl", "has_sig": false, "md5_digest": "b94b3d05c5efb1064a6e6aa702d721de", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": "<3", "size": 41165, "upload_time": "2019-05-17T17:17:58", "url": "https://files.pythonhosted.org/packages/b5/c1/8fd98529f160a683e5535f3bd518620313d1d5dc6b491ac409f6b9eb7e10/Conjur-0.4.5-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1f6ae0ab275e0d68958c07d31e4bddf8", "sha256": "2be8dcb9ae9f87891498fabdfa5c94ba729625b31b172cd57b699f66ff544fa1" }, "downloads": -1, "filename": "Conjur-0.4.5.tar.gz", "has_sig": false, "md5_digest": "1f6ae0ab275e0d68958c07d31e4bddf8", "packagetype": "sdist", "python_version": "source", "requires_python": "<3", "size": 27467, "upload_time": "2019-05-17T17:18:00", "url": "https://files.pythonhosted.org/packages/5d/5b/e270bbe0cb9e8be14e4b91e197b37d51593d87643f41d368a24f969c0fed/Conjur-0.4.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b94b3d05c5efb1064a6e6aa702d721de", "sha256": "a4681dc4af0b5b3dea1c0317a1af4e784cde00759598a0aa1d62d030f6b8b768" }, "downloads": -1, "filename": "Conjur-0.4.5-py2-none-any.whl", "has_sig": false, "md5_digest": "b94b3d05c5efb1064a6e6aa702d721de", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": "<3", "size": 41165, "upload_time": "2019-05-17T17:17:58", "url": "https://files.pythonhosted.org/packages/b5/c1/8fd98529f160a683e5535f3bd518620313d1d5dc6b491ac409f6b9eb7e10/Conjur-0.4.5-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1f6ae0ab275e0d68958c07d31e4bddf8", "sha256": "2be8dcb9ae9f87891498fabdfa5c94ba729625b31b172cd57b699f66ff544fa1" }, "downloads": -1, "filename": "Conjur-0.4.5.tar.gz", "has_sig": false, "md5_digest": "1f6ae0ab275e0d68958c07d31e4bddf8", "packagetype": "sdist", "python_version": "source", "requires_python": "<3", "size": 27467, "upload_time": "2019-05-17T17:18:00", "url": "https://files.pythonhosted.org/packages/5d/5b/e270bbe0cb9e8be14e4b91e197b37d51593d87643f41d368a24f969c0fed/Conjur-0.4.5.tar.gz" } ] }