I am building a simple “Hello World” using Python, Flask and the Shopify Embedded SDK. Following this tutorial—-> https://medium.com/@dernis/shopify-embedded-sdk-with-python-flask-6af197e88c63.
After doing all the work when I go to the link ‘ https://localhost:5000/shopify/install?shop=khawaja-kaleem-com.myshopify.com ‘ to install the application to test store it gives me this error. Need to fix it.
shopify.api_version.VersionNotFoundError.
TRACEBACK (MOST RECENT CALL LAST)
File "C:Users92344Anaconda3libsite-packagesflaskapp.py", line 2309, in __call__
return self.wsgi_app(environ, start_response)
File "C:Users92344Anaconda3libsite-packagesflaskapp.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "C:Users92344Anaconda3libsite-packagesflaskapp.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:Users92344Anaconda3libsite-packagesflask_compat.py", line 35, in reraise
raise value
File "C:Users92344Anaconda3libsite-packagesflaskapp.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "C:Users92344Anaconda3libsite-packagesflaskapp.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:Users92344Anaconda3libsite-packagesflaskapp.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:Users92344Anaconda3libsite-packagesflask_compat.py", line 35, in reraise
raise value
File "C:Users92344Anaconda3libsite-packagesflaskapp.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "C:Users92344Anaconda3libsite-packagesflaskapp.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:Users92344DownloadsHelloShopify-masterhelloshopifyshopify_bpviews.py", line 36, in install
session = shopify.Session(shop_url)
File "C:Users92344Anaconda3libsite-packagesshopifysession.py", line 47, in __init__
self.version = ApiVersion.coerce_to_version(version)
File "C:Users92344Anaconda3libsite-packagesshopifyapi_version.py", line 18, in coerce_to_version
raise VersionNotFoundError
shopify.api_version.VersionNotFoundError
2
Answers
You need to specify the API version you wish to use. Set the version before you make any calls. 2020-10 is the default for now.
See the documentation, it explains everything to you.
https://help.shopify.com/en/api/versioning
The ShopifyAPI package specifies the allowed versions in the ‘shopify/api_version.py’ file. In my case the Shopify platform latest API version is ‘2022-10’ but the latest version allowed by the ShopifyAPI package is ‘2022-07’.
It seems that the ShopifyAPI package is not always updated quickly after the release of a new API version on the Shopify platform. Try aligning the API version to one of the versions allowed to work around this error.