siegerts / printful

Printful API Client for Python 3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

printful

Printful API Client for Python 3

The Printful API client wrapper makes life a bit easier when working with the API. This is an update from the original Python 2.7 client library that was provided here . The module requires an API key as input. The key can be generated in the store settings of your Printful account.

Quickstart

from printful import Printful
pf = Printful(key)
orders = pf.get('orders')

The Printful class extends the Requests library so data, param, json, etc. can be passed just as you would with requests.

address = {
    'recipient': {
        'country_code': 'US',
        'state_code': 'CA'
    },
    'items': [
        {'variant_id': 1, 'quantity': 1},
        {'variant_id': 1118, 'quantity': 2}
    ]
}

pf.post('shipping/rates', json=address)

Or, retrieve only certain orders using offset and limit.

pf.get('orders', params={'offset': 5, 'limit':10})

is equivalent to:

pf.get('orders&offset=10&limit=5')

About

Printful API Client for Python 3

License:MIT License


Languages

Language:Python 100.0%