AssertionError: No api proxy found for service urlfetch! Was a default api proxy provided?

3,076 views
Skip to first unread message

mark

unread,
Apr 8, 2008, 9:30:29 AM4/8/08
to Google App Engine
how to fix this for development?
>>> urlfetch.fetch('http://www.google.com/')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "google/appengine/api/urlfetch.py", line 88, in fetch
apiproxy_stub_map.MakeSyncCall('urlfetch', 'Fetch', request,
response)
File "/tmp/google_appengine/google/appengine/api/
apiproxy_stub_map.py", line 46, in MakeSyncCall
" Was a default api proxy provided?" % service)
AssertionError: No api proxy found for service urlfetch! Was a default
api proxy provided?
>>>

ryan

unread,
Apr 8, 2008, 3:11:33 PM4/8/08
to Google App Engine
It looks like you're trying to use urlfetch from the interactive
shell. The Google App Engine modules need a little extra setup before
they can be used outside of dev_appserver. Try running this first:

from google.appengine.api import apiproxy_stub_map

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


If you want to use other APIs, you'll need to do similar setup for
them:

from google.appengine.api import datastore_file_stub
from google.appengine.api import mail_stub
from google3.apphosting.api import user_service_stub

apiproxy_stub_map.apiproxy.RegisterStub('user',
user_service_stub.UserServiceStub())
apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3',
datastore_file_stub.DatastoreFileStub('your_app_id', '/dev/null', '/
dev/null'))
apiproxy_stub_map.apiproxy.RegisterStub('mail',
mail_stub.MailServiceStub())

mark

unread,
Apr 8, 2008, 3:52:41 PM4/8/08
to google-a...@googlegroups.com
so if i am not doing this from the shell, and let dev_engine run the app, i dont have to do any of this right?

Venkatesh Rangarajan

unread,
Apr 10, 2008, 1:59:38 AM4/10/08
to Google App Engine
I get this when I am trying to call fetch.

Please help.

Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext
\webapp\__init__.py", line 486, in __call__
handler.post(*groups)
File "C:\Program Files\Google\google_appengine\demos\search
\guestbook.py", line 24, in post
res=google.appengine.api.urlfetch.fetch('http://www.localhost:
8080')
File "C:\Program Files\Google\google_appengine\google\appengine\api
\urlfetch.py", line 88, in fetch
apiproxy_stub_map.MakeSyncCall('urlfetch', 'Fetch', request,
response)
File "C:\Program Files\Google\google_appengine\google\appengine\api
\apiproxy_stub_map.py", line 46, in MakeSyncCall

ryan

unread,
Apr 10, 2008, 5:33:06 AM4/10/08
to Google App Engine
@mark: Correct.

@venkatesh: Are you running this outside of dev_appserver? If not, did
you try the code snippet above that initializes apiproxy for urlfetch?

Venkatesh Rangarajan

unread,
Apr 10, 2008, 11:00:04 AM4/10/08
to google-a...@googlegroups.com
Ryan,

I am not running it outside of dev_appserver.

WHere is the code snippet ?  My query and your response shows up as a separate thread in my gmail.

rgds,
Venkatesh

Matthias Sieber

unread,
Mar 27, 2014, 8:16:37 PM3/27/14
to google-a...@googlegroups.com, ryanb+a...@google.com

from google.appengine.api import urlfetch_stub


Am Samstag, 30. März 2013 02:15:00 UTC-7 schrieb Venkatesh Shukla:
I got this as response ... What should I do??

Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    apiproxy_stub_map.apiproxy.RegisterStub('urlfetch',urlfetch_stub.URLFetchServiceStub())
NameError: name 'urlfetch_stub' is not defined
Reply all
Reply to author
Forward
0 new messages