The opfront.OpfrontSession() object is your entry point to the SDK. Upon being instanciated, the session object will log you in using the credentials you provided and will define all resources that can be accessed via our API.

Authenticating with the session

It’s quite simple to handle your credentials in order for you to perform requests on authenticated API resources. You only need to pass your credentials to the session constructor.

At the moment, the python SDK does not support automatic token refresh, which means you’ll have to re-create your session object after a period of six hours.

from opfront import OpfrontSession

# Context manager form
with OpfrontSession(email='myemail@domain.tld', password='p455w0rd') as sess:
    # Your code here

# Regular form
sess = OpfrontSession(email='myemail@domain.tld', password='p455w0rd')

Available Resources

Head over to our REST API Documentation for more details concerning resources.

Resource Endpoint Attribute Name
Banner /banners OpfrontSession().banner
Order /orders OpfrontSession().order
Product /products OpfrontSession().product
Spectacle /spectacles OpfrontSession().spectacle
Store /stores OpfrontSession().store