john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

google app engine urlfetch fix error No api proxy found for service urlfetch

ERROR: No api proxy found for service "urlfetch"

def test_urlfetch():

        import urllib
        from google.appengine.api import urlfetch   # default is 5 second timeout
        from google.appengine.api import apiproxy_stub_map
        from google.appengine.api import urlfetch_stub

        apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
        apiproxy_stub_map.apiproxy.RegisterStub( 'urlfetch',urlfetch_stub.URLFetchServiceStub() )


        response = requests.get( BASE + USER_LIST + AUTH_TOKEN_PARAMETER )
        users = json.loads( response.content )[ 'users' ]
        name = str( time.time() )
        parameters = { 'name': name, 'owner_user_id': users[0]['user_id'], 'auth_token': AUTH_TOKEN }

#        response = requests.post( BASE + ROOM_CREATE, params=parameters )  #an easier, non Google, way of getting things

        encoded_parameters = urllib.urlencode( parameters )
        result = urlfetch.fetch( url=BASE + ROOM_CREATE, payload=encoded_parameters, method=urlfetch.POST )
        print result.status_code
        print result.content

  • « hipchat api examples
  • google app engine remote api console and scripted delete all stats »

Published

May 28, 2013

Category

python-appengine

~78 words

Tags

  • api 3
  • appengine 18
  • engine 12
  • error 14
  • fix 8
  • found 4
  • google 18
  • proxy 5
  • python 180
  • service 12
  • urlfetch 2