I am trying to use python shopify api with OAuth2 and working through the api, and
am trying to move the the django auth sample over to oauth rather than legacy (and not use django, I am just targetting webapp2 on appengine for a much simpler example. 😉
I am running into a problem where after getting a session shopify_session.shop() is called in my handler and I am getting a NameError: “global name ‘Shop’ is not defined”.
Looking at the current code the implementation for this method is (at line 59)
def shop(self):
Shop.current()
but I can’t see how the class Shop could possibly accessible. the class Shop is defined in resources.py and isn’t imported anywhere in session.py. Is this a bug in the api code, or is some magic supposed to going on or some other sort of setup run to inject that class into the session module.
Oops, that method has improperly ported from the ruby shopify_api library. I decided to just remove it entirely, since it was already broken, therefore no apps must depend on it working, and even in the ruby library it isn’t really using the session instance. The only way it would make sense would be if it temporarily activated the session then retrieved the current shop.
The shopify_django_app example app is now updated with Oauth2 support, although the instructions and zip file for django on App Engine still need to be updated.