Python firebase-admin google-app-engine

I am trying to set up firebase-admin using google-app-engine standard python. My developer environment is windows and I followed the library setup as instructed in how to install third party libraries. The firebase website indicates that firebase-admin has been tested on the application engine, but there is no instruction or guidance as to whether it was tested standard, flexible, or both. I started with the simplest example and just tried the first import from a common firebase.

import webapp2
import firebase_admin

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('Hello, World!')


app = webapp2.WSGIApplication([
    ('/', MainPage),
], debug=True)

      

Result

ImportError: Requests library not installed, please install requests package to use request transport.

Library requests in lib during firebase-admin installation, so I'm not sure why I am getting this message. If I add import queries just before importing firebase_admin I get this message.

ImportError: No module named _winreg

I would like to use firebase-admin if at all possible, so if anyone is familiar with this situation and how to resolve it please let me know. Also, I am not interested in using a flexible environment, this is only a question for a standard environment.

+3


source to share


1 answer


-Install the necessary modules under lib; pip install -t lib / firebase-admin pip install -t lib / request-toolbelt

- you can delete the .pyc files as they are only precompiled versions of the .py files that also exist (and will be restored when the .py is executed).

-add below code added appengine_config.py;

from google.appengine.ext import vendor vendor.add ('Lib')

import requests import requests_toolbelt.adapters.appengine



requests_toolbelt.adapters.appengine.monkeypatch ()

import platform

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

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

+1


source







All Articles