Skip to main content
# Stamps API

This is a Python library to interact with Stamps API
(https://stamps.co.id/api). It depends on Python requests library.



## Basic Usage

```python
import stamps

client = stamps.Client(token="ABCDEFGHIJKLMN")


# add transaction
merchant_id = 1
store_id = 1
user_email = "random @ email.com"
total_value = 50000
invoice_number = "invoice-1"
created = "2013-02-15T13:01:01+07"
items = [
{"product_name": "Ice tea", "quantity": 1, "price": 15000},
{"product_name": "Fried Rice", "quantity": 1, "price": 35000},
]
client.transactions.add(merchant_id, store_id, user_email,
total_value, invoice_number, created=created,
items=items)
```


## Handling error


```python
# Inspired by https://stripe.com/docs/api?lang=python#errors
import stamps

client = stamps.Client(token="ABCDEFGHIJKLMN")

try:
response_dict = client.authentication.login("steven@ui.co.id", "correct-password")
except stamps.exceptions.InvalidRequest as e:
# Submitted request is invalid, check error
print(e.http_status)
print(e.error_messages)
# Access the underlying Response object
print(e.response)
except stamps.exceptions.AuthenticationError as e:
# Your token is wrong
pass
except stamps.exceptions.ConnectionError as e:
# HTTP request failed, network trouble
pass
except stamps.exceptions.ServerError as e:
# There's something wrong from stamps API end point
pass
except Exception as e:
# Something else happened, unrelated to Stamps API
pass


```




## Development

```
pip install -e .
pip install responses tox

# to test
tox
```


Release files for stamps-python 0.1.2

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

Source distribution (sdist)

Source distribution for stamps-python 0.1.2
File Size Uploaded
stamps-python-0.1.2.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stamps-python 0.1.2
File Interpreter ABI Platform
stamps_python-0.1.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 12.0 kB

Release files / stamps-python-0.1.2.tar.gz

Download URL stamps-python-0.1.2.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f2313c12ab549d1b094d9da8c97f10f5f8ea96bad3eacccfe1471af3dcda1123
BLAKE2b-256 checksum
How to use checksums
89aa68a4c32ba52961cf8a63d346f07b7faaa736b55569972e033b6f746b5bb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / stamps_python-0.1.2-py2.py3-none-any.whl

Download URL stamps_python-0.1.2-py2.py3-none-any.whl
Size 7.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
051267a3671b7b48de3977cd0d5828957a14d187272d240fcf2d60d36b250eb6
BLAKE2b-256 checksum
How to use checksums
8cc7995090fb00eff26abfe93c5d8f7608b7cbeb74d12120c4de7f920a49fd67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.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