pyPrintful ModuleΒΆ

exception pyPrintful.pfAPIException(message, code)[source]

Bases: pyPrintful.pfException

API Exception Class

exception pyPrintful.pfException[source]

Bases: Exception

Printful exception returned from the API.

class pyPrintful.pyPrintful(key=None, connect=True)[source]

Bases: object

Printful API class. Initializes the connection to the API server.

Parameters:key – API Key (Get it from your store’s dashboard). Note that this is not the consumer key and secret found under store info. Rather, the API key can be found under Store > API and will be two strings separated by a ‘:’.
Returns:A stateful object with an authenticated connection.
VERSION = '1.0.0'
connect()[source]

Configures the connection to the remote server.

do_delete(path, params=None)[source]

Perform a DELETE request to the API

Parameters:
  • path – Request path (e.g. ‘orders’ or ‘orders/123’)
  • params – Additional GET parameters as a dictionary
do_get(path, params=None)[source]

Perform a GET request to the API

Parameters:
  • path – Request path (e.g. ‘orders’ or ‘orders/123’)
  • params – Additional GET parameters as a dictionary
do_post(path, data=None, params=None)[source]

Perform a POST request to the API

Parameters:
  • path – Request path (e.g. ‘orders’ or ‘orders/123’)
  • data – Request body data as a dictionary
  • params – Additional GET parameters as a dictionary
do_put(path, data=None, params=None)[source]

Perform a PUT request to the API

Parameters:
  • path – Request path (e.g. ‘orders’ or ‘orders/123’)
  • data – Request body data as a dictionary
  • params – Additional PUT parameters as a dictionary
get_countries_list()[source]

Retrieve country list

get_file_info(pk=None)[source]

Get file info

get_file_list()[source]

Get list of files

get_item_count()[source]

Returns total available item count from the last request if it supports paging (e.g order list) or nil otherwise

get_order_info(pk=None)[source]

Get order data

get_order_list()[source]

Get order list

get_product_info(pk=None)[source]

Get product’s variant list

Parameters:pk – The Printful identifier for the variant.
get_product_list()[source]

Get all product list

get_shippingrate_calc(data)[source]

Calculate shipping rates

get_store_info()[source]

Get store info

get_syncproduct_info(pk=None)[source]

Get info about sync product

get_syncproduct_list()[source]

Get list of sync products

get_syncvariant_info(pk=None)[source]

Get info about sync variant

get_tax_calc(data=None)[source]

Calculate tax rate

get_tax_geos()[source]

Retrieve state list that requires state tax calc

get_variant_info(pk=None)[source]

Get info about a variant

Parameters:pk – The Printful identifier for the variant.
get_webhooks_info()[source]

Get webhook configuration

put_file_new(data)[source]

Add new file

put_order_cancel(pk=None)[source]

Cancel an order

put_order_confirm(pk=None)[source]

Confirm draft for fulfillment

put_order_new(data=None)[source]

Create new order

put_order_update(pk=None, data=None)[source]

Update order data

put_store_packingslip(data=None)[source]

Change store packing slip

put_syncproduct_remove(pk=None)[source]

Unlink all synced variants of this product

put_webhooks_disable()[source]

Disable webhook support. No data param, because the API doesn’t require it.

put_webhooks_update(data=None)[source]

Set up webhook configuration