Python bindings for the Depoc API
Project description
Depoc API Python Library
I built this library to simplify interaction with the Depoc API, which I'm currently developing. It enables convenient HTTP requests - retrieving, creating, updating, and deleting resources - and allows me to use the API daily in a real business environment.
This library also includes a CLI tool, accessible via the depoc command, which will be described in detail later.
Note: Both the API and this library are actively under development and may contain major issues.
This project was inspired by the stripe-python library.
Installation
Install via pip
$ Pip install depoc
Getting Started
The library requires your account's access token for authentication.
Currently, the only supported method to get your token is to instantiate the Connection class with your username and password.
from depoc import Connection
user = Connection(username="foo", password="bar")
# returns the account's access token
user.token
Usage
You're now ready to start using the library. Instatiate the DepocClient class with the access token you just got.
from depoc import DepocClient
client = DepocClient(user.token)
# Retrieve all customers
customers = client.customer.all()
# Retrieve an specific customer
customer = client.customer.get('ID-KLSJDF331')
Handling Exceptions
Unsuccessful requests raise exceptions. The class of the exception will reflect the sort of error that occurred.
Requirements
- Python 3.12+
Third Party Libraries and Dependencies
The following libraries will be installed when you install the Depoc API library:
- requests
- appdirs
- click
- rich
CLI
Installing the Depoic API Python library provides access to the depoc command. Before using the Depoc CLI, you must configure your credentials by running the depoc login command.
$ depoc login
Username: foo
Password: bar
CLI Usage
depoc [command]
# Run `--help` for detailed information about the CLI commands
depoc [command] --help
Commands
The Depoc CLI supports a broad number of commands. Bellow are some of the most used ones:
- me
- login
- logout
- account
- customer
- transaction
- bank
- payable
- receivable
Command Output
The default output is a box layout rendered with Rich for improved readability.
$ depoc bank
╭─ ANY BANK ──────────────────────────────────────────────────╮
│ $10,374.12 │
│ │
│ 01JN7MFR675GASDKFLJW31N22V │
╰─────────────────────────────────────────────────────────────╯
╭─ THE SECOND BANK ───────────────────────────────────────────╮
│ $744.89 │
│ │
│ 02JNLSKFJALSDKJFSALVKR962V │
╰─────────────────────────────────────────────────────────────╯
╭─ BANK ONE ──────────────────────────────────────────────────╮
│ $2.53 │
│ │
│ 03JN7MFR675G1SJLKDFJ20923J │
╰─────────────────────────────────────────────────────────────╯
Total Balance: $11,121.54
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file depoc-0.1.6.tar.gz.
File metadata
- Download URL: depoc-0.1.6.tar.gz
- Upload date:
- Size: 28.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75756f37f68fa37cd8169ab649add4f975829d5d21e540f5eb931691ef60be19
|
|
| MD5 |
48cd0a3755cff3c26ad0c4e61a4345aa
|
|
| BLAKE2b-256 |
840ef454f8ca46cc42a650c77f9a9bdd6a8c74215c4678e59a179bb2f6b851c4
|
Provenance
The following attestation bundles were made for depoc-0.1.6.tar.gz:
Publisher:
pypi.yml on hugobelem/depoc-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
depoc-0.1.6.tar.gz -
Subject digest:
75756f37f68fa37cd8169ab649add4f975829d5d21e540f5eb931691ef60be19 - Sigstore transparency entry: 226966692
- Sigstore integration time:
-
Permalink:
hugobelem/depoc-api@3bdfcdd160fc566a2ac2e3cc8764929a10781aa8 -
Branch / Tag:
refs/tags/0.1.6 - Owner: https://github.com/hugobelem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@3bdfcdd160fc566a2ac2e3cc8764929a10781aa8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file depoc-0.1.6-py3-none-any.whl.
File metadata
- Download URL: depoc-0.1.6-py3-none-any.whl
- Upload date:
- Size: 50.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31bd90492ecf84748417a8a895a068736ea7be82e408adddb0369fdb2d4e7b29
|
|
| MD5 |
9619592bbca7b16b9c70f4dba6b69ae9
|
|
| BLAKE2b-256 |
a828cf96d69086a34b843088086bb4b46d4182980cc62bb6464e699d042431de
|
Provenance
The following attestation bundles were made for depoc-0.1.6-py3-none-any.whl:
Publisher:
pypi.yml on hugobelem/depoc-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
depoc-0.1.6-py3-none-any.whl -
Subject digest:
31bd90492ecf84748417a8a895a068736ea7be82e408adddb0369fdb2d4e7b29 - Sigstore transparency entry: 226966693
- Sigstore integration time:
-
Permalink:
hugobelem/depoc-api@3bdfcdd160fc566a2ac2e3cc8764929a10781aa8 -
Branch / Tag:
refs/tags/0.1.6 - Owner: https://github.com/hugobelem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@3bdfcdd160fc566a2ac2e3cc8764929a10781aa8 -
Trigger Event:
push
-
Statement type: