Skip to content

jmb/printfulapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Printful API Python Library

A python wrapper for the Printful API.

🚧 This project is very much a work in progress and is very incomplete - Please help! 🚧

Usage

Set your Printful API token up at https://developers.printful.com

Put your Prinful API token into an environment variable PRINTFUL_API_TOKEN or in a .env file:

PRINTFUL_API_TOKEN=<api key string>

To get your list of stores (for example):

from printful.rest_adapter import RestAdapter
from printful.models.generic import Result
from printful.utils import get_api_token
apikey = get_api_token()
pfapi = RestAdapter(api_key=apikey)
stores = pfapi.get(endpoint="/stores")
print(stores.data)

The output is a JSON dictionary with a list of stores with some extra paging and link information:

{'code': 200, 'result': [{'id': 10, 'name': 'My Store', 'type': 'native'}], 'extra': [], 'paging': {'total': 1, 'limit': 20, 'offset': 0}}

In the v2 API, the result list is named data for this example

Contributing

I have been trying to follow the project structure guide as laid out by The Hitchhikers Guide to Python with this guide from pretzellogix.net my initial guide on how to write an API library module.

Please submit pull requests and comments - I'm sure this could be better!

About

Printful API Python Wrapper

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages