My reply is a little late, but I discovered a another way to solve this error. This error, such you sayd, is something associated with the version. You can read this github issue that sayd:
We claim urllib3 works with AppEngine but looks like it's broken today (as of a few months ago). Nobody on our core team uses AppEngine, so maintaining support for it has been a substantial drain.
It means that the urllib3, requests and requests-toolbelt actualy don't have suport from AppEngine, and the pyrebase import this dependencies to have compatibility. If you want to solve without loss the new atualizations, you can remove from the pyrebase file these lines:
19 - from requests.packages.urllib3.contrib.appengine import is_appengine_sandbox
20 - from requests_toolbelt.adapters import appengine
And replace this line:
# 82 - adapter = appengine.AppEngineAdapter(max_retries=3)
82 - raise Exception('Appengine is not supported by pyrebase.')
You will need to have a way to discover if is a appengine, what is_appengine_sandbox
did. So in the firsts lines you paste this function:
def is_appengine_sandbox():
appengine_runtime = 'APPENGINE_RUNTIME' in os.environ
is_local_appengine = (appengine_runtime and 'Development/' in os.environ['SERVER_SOFTWARE'])
is_prod_appengine = (appengine_runtime and 'Google App Engine/' in os.environ['SERVER_SOFTWARE']
and not is_prod_appengine_mvms)
is_prod_appengine_mvms = os.environ.get('GAE_VM', False) == 'true'
return (is_local_appengine or is_prod_appengine or is_prod_appengine_mvms) and not is_prod_appengine_mvms
It's the static def from is_appengine_sandbox
It's a temporary solution, maybe somebody with more experience in AppEngine will create a updated version from this, that accept AppEngine support.
OBS: If you can downgrade, will be better. It's answer is only if you need the newest libraries.
ImportError: cannot import name 'appengine' from 'urllib3.contrib'
. Also the latestrequests-toolbelt
version as of 2024-06-25 is 1.0.0. – Twofold