Giter Site home page Giter Site logo

Comments (3)

hiranya911 avatar hiranya911 commented on June 5, 2024

As mentioned in my response on the Google group, you need to follow the instructions at https://google-auth.readthedocs.io/en/latest/user-guide.html#the-app-engine-standard-environment

(specifically the bit regarding the requests-toolbelt library)

from firebase-admin-python.

sww314 avatar sww314 commented on June 5, 2024

This helped me:
https://groups.google.com/forum/#!topic/firebase-talk/FzEG2U6SRN8

I solved with requests-toolbelt module, which is described in
https://stackoverflow.com/questions/9604799/can-python-requests-library-be-used-on-google-app-engine

pip install -t lib/ requests-toolbelt and below code in appengine_config.py:

import requests
import requests_toolbelt.adapters.appengine

# Use the App Engine Requests adapter. This makes sure that Requests uses
# URLFetch.
requests_toolbelt.adapters.appengine.monkeypatch()

# also monkey patch platform.platform() from https://code.google.com/p/googleappengine/issues/detail?id=12982
import platform

def patch(module):
    def decorate(func):
        setattr(module, func.func_name, func)
        return func
    return decorate


@patch(platform)
def platform():
    return 'AppEngine'

from firebase-admin-python.

hamx0r avatar hamx0r commented on June 5, 2024

A critical piece of this is that, when using firebase, you must import firebase modules after monkeypatching, like this:

import requests
import requests_toolbelt.adapters.appengine
requests_toolbelt.adapters.appengine.monkeypatch()

# Now that we've imported requests, the toolbelt, and finished monkeypatch(), we can import firebase:
from firebase_admin import auth, initialize_app  # This must go after the monkeypatch()

from firebase-admin-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.