Prevent session leaking with shopify object

Highlighted
Tourist
12 0 1

So in the python examples, shopify object is iniated directly on the imported module:

import shopify
with shopify.Session.temp("SHOP_NAME.myshopify.com", token):
product = shopify.Product.find()

# don't forget to clear session

 

In frameworks like Flask, the server serves many requests from a single process. How do make sure that the shopify sessions do not mix between requests? In general what I'm doing with other services, is instantiate a new service session object for every request, but here it looks like all the requests use the same import.

 

Please enlighten me,

 

thanks

0 Likes