If you are using Python Shopify API
and getting following error
"Exceeded 4 calls per second for api client. Reduce request rates to resume uninterrupted service."
but want your script to continue working with some timeout after that,
you can use following script from shopify_limits_patch.py
.
For that just copy shopify_limits_patch.py
to your project and import shopify_limits_patch
.
Or if you want to call it implicitly import it, remove last line patch_shopify_with_limits()
and call it before all your shopify calls.
This is solution for issue described here: Shopify/shopify_python_api#256
If you have any suggestions for code - leave comment :)
I tried to implicitly import it, removed last line patch_shopify_with_limits() and called it before all my shopify calls. But I got errors for several endpoints. Seems like the recursion was using all memory. My django app will die after running for 1 - 2 days. After that I gracefully kill gunicorn and the app will be up again. Currently, I am trying to replace the while loop with a for loop running for several times. Just not sure if it can fix the issue yet.
Internal Server Error: /app_spo/getOptimizedDetail
RecursionError at /app_spo/getOptimizedDetail
maximum recursion depth exceeded while calling a Python object
It indicates that this line gives the error:
File "/var/www/app.seo-product-optimizer.com/app_spo/views/listProductAjax/shopify_limits_patch.py" in patched_open
13. return func(self, *args, **kwargs)
Request Method: GET
Django Version: 1.11.26
Python Version: 3.7.5
update:
Turn out that I am sending a bunch of ajax requests to my server. When there are too many requests, it will use up the memory and give the error.