Skip to main content

Payload Python Library

Project description

# Payload Python Library

A Python library for integrating [Payload](https://payload.co).

## Installation

## Install using pip

```bash
pip install payload-api
```

## Get Started

Once you've installed the Payload Python library to your environment,
import the `payload` module to get started. **Note:** We recommend
using the shorthand name of `pl` when importing.

```python
import payload as pl
```

### API Authentication

To authenticate with the Payload API, you'll need a live or test API key. API
keys are accessible from within the Payload dashboard.

```python
import payload as pl
pl.api_key = 'secret_key_3bW9JMZtPVDOfFNzwRdfE'
```

### Creating an Object

Interfacing with the Payload API is done primarily through Payload Objects. Below is an example of
creating a customer using the `pl.Customer` object.


```python
# Create a Customer
customer = pl.Customer.create(
email='matt.perez@example.com',
full_name='Matt Perez'
)
```


```python
# Create a Payment
payment = pl.Payment.create(
amount=100.0,
payment_method=pl.Card(
card_number='4242 4242 4242 4242'
)
)
```

### Accessing Object Attributes

Object attributes are accessible through both dot notation.

```python
customer.name
```

### Updating an Object

Updating an object is a simple call to the `update` object method.

```python
# Updating a customer's email
customer.update( email='matt.perez@newwork.com' )
```

### Selecting Objects

Objects can be selected using any of their attributes.

```python
# Select a customer by email
var customers = pl.Customer.filter_by(
email='matt.perez@example.com'
)
```

Use the `pl.attr` attribute helper
interface to write powerful queries with a little extra syntax sugar.

```python
payments = pl.Payments.filter_by(
pl.attr.amount > 100,
pl.attr.amount < 200,
pl.attr.description.contains("Test"),
pl.attr.created_at > datetime(2019,2,1))
).all()
```

## Documentation

To get further information on Payload's Python library and API capabilities,
visit the unabridged [Payload Documentation](https://docs.payload.co/?python).


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

payload-api-0.1.2.tar.gz (6.6 kB view details)

Uploaded Source

Built Distributions

payload_api-0.1.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

payload_api-0.1.2-py2-none-any.whl (10.2 kB view details)

Uploaded Python 2

File details

Details for the file payload-api-0.1.2.tar.gz.

File metadata

  • Download URL: payload-api-0.1.2.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.7

File hashes

Hashes for payload-api-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f3c6d7d1381643b7db405cd9e2c36df170519ad27e2f61342fc712161b8bfa34
MD5 7c22afe1244929e9d3938e58aa9d77e8
BLAKE2b-256 55d87ace05c78d2b9903b46cf9a2b70dc9a1dd03a8a7df9c3379633ee1913c67

See more details on using hashes here.

File details

Details for the file payload_api-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: payload_api-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.7

File hashes

Hashes for payload_api-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 80ec47d56b8dac8940d6bca042098cd8e7c4d3197773e31c15d561c72ce96fae
MD5 2750623bf318912efbc2a0ba8d2d6cef
BLAKE2b-256 fa8a7e21fec9d00a1a9ad48f2af82013d3ee7f75e605ca89ebc9ef7f66350a65

See more details on using hashes here.

File details

Details for the file payload_api-0.1.2-py2-none-any.whl.

File metadata

  • Download URL: payload_api-0.1.2-py2-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.7

File hashes

Hashes for payload_api-0.1.2-py2-none-any.whl
Algorithm Hash digest
SHA256 07805826fe57f01f0b2853ce8b80104136a09a834600829792100966fb43bf4c
MD5 cffb5836fef34e8ce0a4b7d7868c0500
BLAKE2b-256 5520e8a50c18622dd6a93f977c9a6d7f9cb4d6d9508bc3db0293ae46219d9820

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page