# trustpilot
[![Build Status](https://travis-ci.org/trustpilot/python-trustpilot.svg?branch=master)](https://travis-ci.org/trustpilot/python-trustpilot) [![Latest Version](https://img.shields.io/pypi/v/trustpilot.svg)](https://pypi.python.org/pypi/trustpilot) [![Python Support](https://img.shields.io/pypi/pyversions/trustpilot.svg)](https://pypi.python.org/pypi/trustpilot)
Python HTTP client for [Trustpilot](https://developers.trustpilot.com/).
### Features
- Extends the [`requests.Session`](http://docs.python-requests.org/en/master/api/#requests.Session) class with automatic authentication for public and private endpoints
- GET, POST, PUT, DELETE, HEAD, OPTIONS and PATCH methods are exposed on module level
- Implements session factory and default singleton session
- Provides a simple hook system
- [CLI](#CLI) tool with basic HTTP commands
## Installation
Install the package from [PyPI](http://pypi.python.org/pypi/) using [pip](https://pip.pypa.io/):
```
pip install trustpilot
```
## Usage
_(for **full usage documentation** checkout [docs](https://github.com/trustpilot/python-trustpilot/blob/master/docs/README.md))_
```python
from trustpilot import client
client.default_session.setup(
api_host="https://api.trustpilot.com",
api_key="YOUR_API_KEY",
)
response = client.get("/foo/bar")
status_code = response.status_code
```
You can rely on environment variables for the setup of sessions so
```bash
$ env
TRUSTPILOT_API_HOST=https://api.trustpilot.com
TRUSTPILOT_API_KEY=foo
TRUSTPILOT_API_SECRET=bar
```
### CLI
The `trustpilot_api_client` command is bundled with the install
```bash
Usage: trustpilot_api_client [OPTIONS] COMMAND [ARGS]...
Options:
--host TEXT Host name
--version TEXT Api version
--key TEXT Api key
--secret TEXT Api secret
--token_issuer_host TEXT Token issuer host name
--username TEXT Trustpilot username
--password TEXT Trustpilot password
-c, --config FILENAME Json config file name
-e, --env FILENAME Dot env file
-of, --outputformat [json|raw] Output format, default=json
-v, --verbose Verbosity level
--help Show this message and exit.
Commands:
create-access-token Get an access token
delete Send a DELETE request
get Send a GET request
post Send a POST request with specified data
put Send a PUT request with specified data
```
You can also supply the variables with:
**--config/-c** : As JSON config file in the following format:
```json
{
"TRUSTPILOT_API_HOST": "foo",
"TRUSTPILOT_API_KEY": "bar",
"TRUSTPILOT_API_SECRET": "baz",
"TRUSTPILOT_API_VERSION": "v1",
"TRUSTPILOT_USERNAME": "username",
"TRUSTPILOT_PASSWORD": "password"
}
```
or **--env/-e** : As DotEnv config file in the following format:
```ini
TRUSTPILOT_API_HOST=foo
TRUSTPILOT_API_KEY=bar
TRUSTPILOT_API_SECRET=baz
TRUSTPILOT_API_VERSION=v1
TRUSTPILOT_USERNAME=username
TRUSTPILOT_PASSWORD=password
```
## Changelog
see [HISTORY.md](https://github.com/trustpilot/python-trustpilot/blob/master/HISTORY.md)
## Issues / DEV
Report issues [here](https://github.com/trustpilot/python-trustpilot/issues) and we welcome collaboration through PullRequests :-)
Raw data
{
"_id": null,
"home_page": "https://github.com/trustpilot/python-trustpilot",
"name": "trustpilot",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "trustpilot,api,client",
"author": "John Sutherland",
"author_email": "johns@trustpilot.com",
"download_url": "https://files.pythonhosted.org/packages/52/61/a7fe623ac9fafc09120819740ad3eb87280c81d007c69ee84bc8e691b13c/trustpilot-10.0.1.tar.gz",
"platform": null,
"description": "# trustpilot\n\n[![Build Status](https://travis-ci.org/trustpilot/python-trustpilot.svg?branch=master)](https://travis-ci.org/trustpilot/python-trustpilot) [![Latest Version](https://img.shields.io/pypi/v/trustpilot.svg)](https://pypi.python.org/pypi/trustpilot) [![Python Support](https://img.shields.io/pypi/pyversions/trustpilot.svg)](https://pypi.python.org/pypi/trustpilot)\n\nPython HTTP client for [Trustpilot](https://developers.trustpilot.com/).\n\n### Features\n\n- Extends the [`requests.Session`](http://docs.python-requests.org/en/master/api/#requests.Session) class with automatic authentication for public and private endpoints\n- GET, POST, PUT, DELETE, HEAD, OPTIONS and PATCH methods are exposed on module level\n- Implements session factory and default singleton session\n- Provides a simple hook system\n- [CLI](#CLI) tool with basic HTTP commands\n\n\n## Installation\n\nInstall the package from [PyPI](http://pypi.python.org/pypi/) using [pip](https://pip.pypa.io/):\n\n```\npip install trustpilot\n```\n\n## Usage\n\n_(for **full usage documentation** checkout [docs](https://github.com/trustpilot/python-trustpilot/blob/master/docs/README.md))_\n\n```python\nfrom trustpilot import client\nclient.default_session.setup(\n api_host=\"https://api.trustpilot.com\",\n api_key=\"YOUR_API_KEY\",\n)\nresponse = client.get(\"/foo/bar\")\nstatus_code = response.status_code\n```\n\nYou can rely on environment variables for the setup of sessions so\n\n```bash\n$ env\nTRUSTPILOT_API_HOST=https://api.trustpilot.com\nTRUSTPILOT_API_KEY=foo\nTRUSTPILOT_API_SECRET=bar\n```\n\n### CLI\n\nThe `trustpilot_api_client` command is bundled with the install\n\n```bash\nUsage: trustpilot_api_client [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n --host TEXT Host name\n --version TEXT Api version\n --key TEXT Api key\n --secret TEXT Api secret\n --token_issuer_host TEXT Token issuer host name\n --username TEXT Trustpilot username\n --password TEXT Trustpilot password\n -c, --config FILENAME Json config file name\n -e, --env FILENAME Dot env file\n -of, --outputformat [json|raw] Output format, default=json\n -v, --verbose Verbosity level\n --help Show this message and exit.\n\nCommands:\n create-access-token Get an access token\n delete Send a DELETE request\n get Send a GET request\n post Send a POST request with specified data\n put Send a PUT request with specified data\n```\n\nYou can also supply the variables with:\n\n**--config/-c** : As JSON config file in the following format:\n\n```json\n{\n \"TRUSTPILOT_API_HOST\": \"foo\",\n \"TRUSTPILOT_API_KEY\": \"bar\",\n \"TRUSTPILOT_API_SECRET\": \"baz\",\n \"TRUSTPILOT_API_VERSION\": \"v1\",\n \"TRUSTPILOT_USERNAME\": \"username\",\n \"TRUSTPILOT_PASSWORD\": \"password\"\n}\n```\n\nor **--env/-e** : As DotEnv config file in the following format:\n\n```ini\nTRUSTPILOT_API_HOST=foo\nTRUSTPILOT_API_KEY=bar\nTRUSTPILOT_API_SECRET=baz\nTRUSTPILOT_API_VERSION=v1\nTRUSTPILOT_USERNAME=username\nTRUSTPILOT_PASSWORD=password\n```\n\n## Changelog\n\nsee [HISTORY.md](https://github.com/trustpilot/python-trustpilot/blob/master/HISTORY.md)\n\n## Issues / DEV\n\nReport issues [here](https://github.com/trustpilot/python-trustpilot/issues) and we welcome collaboration through PullRequests :-)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Trustpilot API client including CLI tool",
"version": "10.0.1",
"project_urls": {
"Homepage": "https://github.com/trustpilot/python-trustpilot",
"Repository": "https://github.com/trustpilot/python-trustpilot"
},
"split_keywords": [
"trustpilot",
"api",
"client"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6f65338893a0ce04e0937d680d619811f7a9f2ea7c1a5576369f0052154580a7",
"md5": "017e7619504a52b7b1372bdb132e0473",
"sha256": "9b4e48b9ec4ac689c050bcbe17547923014b71962c651469d050078afc99869f"
},
"downloads": -1,
"filename": "trustpilot-10.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "017e7619504a52b7b1372bdb132e0473",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 10515,
"upload_time": "2023-10-19T11:49:20",
"upload_time_iso_8601": "2023-10-19T11:49:20.641589Z",
"url": "https://files.pythonhosted.org/packages/6f/65/338893a0ce04e0937d680d619811f7a9f2ea7c1a5576369f0052154580a7/trustpilot-10.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5261a7fe623ac9fafc09120819740ad3eb87280c81d007c69ee84bc8e691b13c",
"md5": "28adcb02308b08e36138a12b611db8f7",
"sha256": "cfd965d007c23908e07ff0513de79b762423872eacb55e547b60739d01d211ed"
},
"downloads": -1,
"filename": "trustpilot-10.0.1.tar.gz",
"has_sig": false,
"md5_digest": "28adcb02308b08e36138a12b611db8f7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 9061,
"upload_time": "2023-10-19T11:49:23",
"upload_time_iso_8601": "2023-10-19T11:49:23.095671Z",
"url": "https://files.pythonhosted.org/packages/52/61/a7fe623ac9fafc09120819740ad3eb87280c81d007c69ee84bc8e691b13c/trustpilot-10.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-19 11:49:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "trustpilot",
"github_project": "python-trustpilot",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"lcname": "trustpilot"
}