Skip to content

Simple Python3 package that uses requests to interact with the Finerworks art and photo printing REST API.

License

Notifications You must be signed in to change notification settings

cmd-not-found/finerworks

Repository files navigation

finerworks

finerworks is a Python 3 package for the Finerworks art printing & drop shipping service through their REST API.

Usage

Requirements

  • You will need to request an API key through Finerworks here.
  • Read Finerworks API docs here.
  • Make note that initially your API keys aren't considered live until you check the box on your account profile.

Quickstart

>>> import json
>>> import finerworks
>>> f = finerworks.api(web_api_key='foo', app_key='bar')
>>> f.login()

Retrieving an Order's Status

>>> f.order_status(123456)

Validate an Address

addr = {
    "first_name":"Harry",
    "last_name":"Potter",
    "address_1":"350 Fifth Avenue",
    "city":"New York City",
    "state_code":"NY",
    "zip_postal_code":"10118",
    "country_code":"US"
}
>>> resp = f.address_validate(addr)
>>> print(json.dumps(resp,indent=4))
{
    "status": {
        "success": true,
        "status_code": 200,
        "message": "",
        "debug": null
    },
    "address": {
        "first_name": "Harry",
        "last_name": "Potter",
        "company_name": null,
        "address_1": "350 Fifth Avenue",
        "address_2": null,
        "address_3": null,
        "city": "New York City",
        "state_code": "ny",
        "province": "",
        "zip_postal_code": "10118",
        "country_code": "us",
        "phone": null,
        "email": null,
        "address_order_po": null
    }
}

Submiting an Order

addr = {
    "first_name":"Harry",
    "last_name":"Potter",
    "address_1":"350 Fifth Avenue",
    "city":"New York City",
    "state_code":"NY",
    "zip_postal_code":"10118",
    "country_code":"US"
}
product = {
    "product_qty":1,
    "product_sku":"AP89646P264575"
}
resp = f.order_submit(product=product, recipient=addr, order_no="12345679", shipping_code="EC", test=True, validate_only=True)
>>> print(json.dumps(resp,indent=4))
{
    "status": {
        "success": true,
        "status_code": 200,
        "message": "",
        "debug": null
    },
    "orders": null,
    "debug": null,
    "misc": null
}

NOTE: There are two important flags here validate_only and test which both roughly mean this isn't a real order. Also, the product_sku can be pre-generated by populating your Virtual Inventory in the Web UI of your Finerworks account.

Cancelling or Pausing an Order

>>> resp = f.order_update(123456, 'cancel') # options: pending, hold, cancel
>>> print(json.dumps(resp, indent=4))
{
    "success": true,
    "status_code": 400,
    "message": "Your order status has been changed to cancel.",
    "debug": null
}

Future Work

  • Add support for /update_customer endpoint
  • Add support for /frame_builder endpoint
  • Add support for /order_shipping endpoint
  • Add support for /submit_note endpont
  • Add support for /get_product_details endpoint
  • Improve handling of function args for submitting orders
  • Improve structure and objects for order submission

Contributing

Open to any & all issues, suggestions, or contributions.

Authors and Acknowledgement

@cmd-not-found

About

Simple Python3 package that uses requests to interact with the Finerworks art and photo printing REST API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages