A tiny python library that links against libcogito.
Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
README.md
cogito.py
setup.py

README.md

cogito-py

Build Status PyPI

A tiny python library that links against libcogito.

Usage

>>> import cogito
>>> print cogito.to_json('ALLOW a on b;')
[
  {
    "Effect": "Allow",
    "Action": [
      "a"
    ],
    "Resource": [
      "b"
    ]
  }
]

>>> print cogito.to_iam('[{ "Effect": "Allow", "Action": "a", "Resource": "b" }]')
ALLOW
  a
ON
  b;

If your libcogito library is in a non-standard location, you should set the COGITO_PATH environment variable before you import the cogito module.

import os
os.environ['COGITO_PATH'] = os.path.join(os.getcwd(), 'local', 'lib', 'libcogito.so')
import cogito

Development

To run tests, run py.test. To release a new version:

pip install twine
python setup.py sdist
python setup.py bdist_wheel --universal
twine upload dist/*

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/localytics/cogito-py.

License

The package is available as open source under the terms of the MIT License.