[Python] NDB Python Error returning object has no attribute 'connection_from_host'

Discussão em 'Python' iniciado por Stack, Maio 15, 2025.

  1. Stack

    Stack Membro Participativo

    I have the code below which is built on top of ndb.

    When running I receive the two errors below.

    Can I ask for some guidance, specifically what is the connection_from_host referring to?

    import flask

    import config
    import util

    app = flask.Flask(__name__)

    from google.appengine.api import app_identity
    from google.appengine.api import taskqueue, search, memcache
    from apiclient.discovery import build, HttpError
    from google.cloud import ndb
    #from oauth2client.client import GoogleCredentials
    from apiclient.http import MediaIoBaseUpload
    from datetime import datetime, timedelta
    from functools import partial
    from io import BytesIO
    import os
    from os.path import splitext, basename
    from model import Config
    from model import VideosToCollections
    from pytz import timezone
    import datetime
    import httplib2
    import iso8601
    import time
    import requests
    import requests_toolbelt.adapters.appengine
    requests_toolbelt.adapters.appengine.monkeypatch()

    from operator import attrgetter
    import model
    from model import CallBack
    import re
    import config





    import google.appengine.api

    client = ndb.Client()
    def ndb_wsgi_middleware(wsgi_app):
    def middleware(environ, start_response):
    with client.context():
    return wsgi_app(environ, start_response)

    return middleware

    app.wsgi_app = ndb_wsgi_middleware(google.appengine.api.wrap_wsgi_app(app.wsgi_app))

    @app.route('/collectionsync/', methods=['GET'])
    #@ndb.transactional
    def collectionsync():
    collection_dbs, collection_cursor = model.Collection.get_dbs( order='name' )


    This returns:


    /layers/google.python.pip/pip/lib/python3.12/site-packages/urllib3/contrib/appengine.py:111: AppEnginePlatformWarning: urllib3 is using URLFetch on Google App Engine sandbox instead of sockets. To use sockets directly instead of URLFetch see https://urllib3.readthedocs.io/en/1.26.x/reference/urllib3.contrib.html.

    google.api_core.exceptions.RetryError: Maximum number of 3 retries exceeded while calling <function make_call..rpc_call at 0x3ee3d42d6840>, last exception: 503 Getting metadata from plugin failed with error: '_AppEnginePoolManager' object has no attribute 'connection_from_host'
    ​

    Continue reading...

Compartilhe esta Página