|
| 1 | +# exonetapi |
| 2 | +Python 3 library for the Exonet API. |
| 3 | + |
| 4 | +[![Latest Version on Packagist][ico-version]][link-pypi] |
| 5 | +[![Python Versions][ico-pyversions]][link-pypi] |
| 6 | +[![Software License][ico-license]](LICENSE.md) |
| 7 | + |
| 8 | +## Install |
| 9 | +Install using pip: |
| 10 | + |
| 11 | +```bash |
| 12 | +pip install exonetapi |
| 13 | +``` |
| 14 | + |
| 15 | +## Usage |
| 16 | +Example to get the user details of the authorised user: |
| 17 | + |
| 18 | +```py |
| 19 | +from exonetapi import Client |
| 20 | + |
| 21 | +# Create a new Client. |
| 22 | +client = Client('https://api.exonet.nl') |
| 23 | + |
| 24 | +# Authorize with a personal access token. |
| 25 | +client.authenticator.set_token('<YOUR_TOKEN>') |
| 26 | + |
| 27 | +# Make an API call. Get details of the authorized user. |
| 28 | +user_details = client.resource('me').get() |
| 29 | + |
| 30 | +# Print user's name. |
| 31 | +print('Autorized as: {name}'.format( |
| 32 | + name=user_details.attribute('name') |
| 33 | +)) |
| 34 | +``` |
| 35 | + |
| 36 | +See the `/docs` directory for complete documentation and additional code snippets. |
| 37 | + |
| 38 | +## Examples |
| 39 | + |
| 40 | +The `/examples` directory contains ready to use scripts to help you get started. These examples can be executed with your personal access token. One of them gets a ticket with it's emails and prints the details:: |
| 41 | + |
| 42 | +``` |
| 43 | +$ python examples/ticket_details.py <YOUR-TOKEN> |
| 44 | +``` |
| 45 | +This should make two API calls and print the ticket and email details for one of your tickets. |
| 46 | + |
| 47 | +## Change log |
| 48 | + |
| 49 | +Please see [releases][link-releases] for more information on what has changed recently. |
| 50 | + |
| 51 | +# Contributing |
| 52 | + |
| 53 | +When contributing to this repository, please first discuss the change you wish |
| 54 | +to make via issue, email, or any other method with the owners of this repository |
| 55 | +before making a change. |
| 56 | + |
| 57 | +Please note we have a code of conduct, please follow it in all your interactions |
| 58 | +with the project. |
| 59 | + |
| 60 | +### Issues and feature requests |
| 61 | + |
| 62 | +You've found a bug in the source code, a mistake in the documentation or maybe |
| 63 | +you'd like a new feature? You can help us by submitting an issue to our |
| 64 | +[GitHub Repository][github]. Before you create an issue, make sure you search |
| 65 | +the archive, maybe your question was already answered. |
| 66 | + |
| 67 | +Even better: You could submit a pull request with a fix / new feature! |
| 68 | + |
| 69 | +### Pull request process |
| 70 | + |
| 71 | +1. Search our repository for open or closed [pull requests][prs] that relates |
| 72 | + to your submission. You don't want to duplicate effort. |
| 73 | + |
| 74 | +2. You may merge the pull request in once you have the sign-off of two other |
| 75 | + developers, or if you do not have permission to do that, you may request |
| 76 | + the second reviewer to merge it for you. |
| 77 | + |
| 78 | +## Setting up development environment |
| 79 | + |
| 80 | +This Python project is fully managed using the [Poetry][poetry] dependency |
| 81 | +manager. |
| 82 | + |
| 83 | +You need at least: |
| 84 | + |
| 85 | +- Python 3.8+ |
| 86 | +- [Poetry][poetry-install] |
| 87 | + |
| 88 | +Install all packages, including all development requirements: |
| 89 | + |
| 90 | +```bash |
| 91 | +poetry install |
| 92 | +``` |
| 93 | + |
| 94 | +Poetry creates by default an virtual environment where it installs all |
| 95 | +necessary pip packages, to enter or exit the venv run the following commands: |
| 96 | + |
| 97 | +```bash |
| 98 | +poetry shell |
| 99 | +exit |
| 100 | +``` |
| 101 | + |
| 102 | +*Now you're all set to get started!* |
| 103 | + |
| 104 | +To run the Python tests: |
| 105 | + |
| 106 | +```bash |
| 107 | +poetry run pytest |
| 108 | +``` |
| 109 | + |
| 110 | +To run the bandit checks: |
| 111 | + |
| 112 | +```bash |
| 113 | +poetry run bandit |
| 114 | +``` |
| 115 | + |
| 116 | + |
| 117 | +## Security |
| 118 | + |
| 119 | +If you discover any security related issues please email [[email protected]](mailto:[email protected]) instead |
| 120 | +of using the issue tracker. |
| 121 | + |
| 122 | + |
| 123 | +## Credits |
| 124 | + |
| 125 | +- [Exonet][link-author] |
| 126 | +- [All Contributors][link-contributors] |
| 127 | + |
| 128 | + |
| 129 | +## License |
| 130 | + |
| 131 | +[MIT License](LICENSE.md) |
| 132 | + |
| 133 | +[ico-version]: https://img.shields.io/pypi/v/exonetapi.svg?style=flat-square |
| 134 | +[ico-license]: https://img.shields.io/pypi/l/exonetapi.svg?style=flat-square |
| 135 | +[ico-pyversions]: https://img.shields.io/pypi/pyversions/exonetapi.svg?style=flat-square |
| 136 | + |
| 137 | +[github]: https://github.com/exonet/exonet-api-python/issues |
| 138 | +[prs]: https://github.com/exonet/exonet-api-python/pulls |
| 139 | + |
| 140 | +[link-pypi]: https://pypi.org/project/exonetapi/ |
| 141 | +[link-author]: https://github.com/exonet |
| 142 | +[link-releases]: https://github.com/exonet/exonet-api-python/releases |
| 143 | +[link-contributors]: ../../contributors |
| 144 | + |
| 145 | +[poetry-install]: https://python-poetry.org/docs/#installation |
| 146 | +[poetry]: https://python-poetry.org |
| 147 | +[pre-commit]: https://pre-commit.com |
0 commit comments