Python SDK for accessing the TravelPerk API
Project description
travelperk-http-python
About
This is an unofficial package for acessing the TravelPerk official Web API from your Python language project. It is designed so you can easily query and retrieve all data hold on their platform and accessible through the API.
Installation
This package is hosted on PyPi, you can install it using any python package manager.
$ pip install travelperk-http-python
Getting started
Before getting started retrieving querying information from the TravelPerk Web API you first need to get an API Key.
Getting a TravelPerk instance
For querying the data you need to get a TravelPerk instance, here are two ways to get a TravelPerk API instance depending on how you authenticate with their API.
At TravelPerk there are two ways to authenticate, using an API Key or OAuth2.
For API Key Authentication
If you have an API Key for authenticating you need to call the Service Provider's build
method passing your api key, and a boolean indicating if you will be using the sandbox environment or not like this:
from travelperk_http_python.builder.builder import build
is_sandbox = False
travelperk = build("YOUR_API_KEY", is_sandbox)
For OAuth Authentication
Due to time constrains the OAuth authentication flow is not fully implemented so is not supported yet, see this GitHub issue
Retrieving data
Everything is ready, you can start asking for the data.
travelperk.expenses().invoices().all()
For further information refer to the documentation linked in the next section.
Documentation
The full documentation can be found in the wiki section of this github repository. Also you can refer to the official TravelPerk Web API documentation
License
Contributing
Any suggestion, bug reports, prs or any other kind enhacements are welcome. Just open an issue first, for creating a PR remember this project has linting checkings and unit tests so any PR should comply with both before beign merged, this checks will be automatically applied when opening or modifying the PRs.
Local development
This project comes with a docker-compose.yml
file so if you use Docker and docker-compose you can develop without installing anything on your local environment. Just run docker-compose up --build
for the first time to setup the container and launch the tests. Pytest is configured as the entrypoint so just run docker-compose up
everytime you want the tests to execute on the Dockerized Python development container.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for travelperk-http-python-1.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f316ad980b572fbb505d75afb8f6f2ef8bf6104b3d9ead75517e058d8c7a936d |
|
MD5 | cbe22c0759a37c4e85155ccc2b745ed1 |
|
BLAKE2b-256 | a660c6bca73cd46e28cfa5ac4bf3f28cdb6d829e455b78d657c16f50dc90cfc8 |
Hashes for travelperk_http_python-1.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8f72215894359bb0986f49ea0e135935d889c401f22e536e32527b0be7b9dd2 |
|
MD5 | 71f831477cda2d2f2a4c7e4cc23508b3 |
|
BLAKE2b-256 | ee057f1062bad763d297d609166ccd399963ce102bb95070d60e666d64948f9a |