Skip to main content

trustpilot

Build Status Latest Version Python Support

Python HTTP client for Trustpilot.

Features

  • Extends the 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 tool with basic HTTP commands

Installation

Install the package from PyPI using pip:

pip install trustpilot

Usage

(for full usage documentation checkout docs)

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

$ 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

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:

{
  "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:

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

Issues / DEV

Report issues here and we welcome collaboration through PullRequests :-)

Release files for trustpilot 10.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trustpilot 10.0.1
File Size Uploaded
trustpilot-10.0.1.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for trustpilot 10.0.1
File Interpreter ABI Platform
trustpilot-10.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / trustpilot-10.0.1.tar.gz

Download URL trustpilot-10.0.1.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cfd965d007c23908e07ff0513de79b762423872eacb55e547b60739d01d211ed
BLAKE2b-256 checksum
How to use checksums
5261a7fe623ac9fafc09120819740ad3eb87280c81d007c69ee84bc8e691b13c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.4 Darwin/22.6.0

Release files / trustpilot-10.0.1-py3-none-any.whl

Download URL trustpilot-10.0.1-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b4e48b9ec4ac689c050bcbe17547923014b71962c651469d050078afc99869f
BLAKE2b-256 checksum
How to use checksums
6f65338893a0ce04e0937d680d619811f7a9f2ea7c1a5576369f0052154580a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.4 Darwin/22.6.0

Release history Release notifications | RSS feed

This release

10.0.1 This release

2 release files

9.0.0

2 release files

8.1.0

2 release files

8.0.1

2 release files

8.0.0

2 release files

7.0.1

1 release file

7.0.0

1 release file

6.1.0

1 release file

6.0.10

1 release file

6.0.9

1 release file

6.0.8

1 release file

6.0.7

1 release file

6.0.6

1 release file

6.0.5

1 release file

6.0.4

1 release file

6.0.2

1 release file

6.0.1

1 release file

5.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page