[GAE]urlfetchをshellから使ってみる

普通にやろうとすると以下のメッセージが表示されてしまって出来ない。
「AssertionError: No api proxy found for service “urlfetch”」

ということで、どうすればいいかのメモ。

from google.appengine.api import apiproxy_stub_map, urlfetch_stub
apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
apiproxy_stub_map.apiproxy.RegisterStub('urlfetch', urlfetch_stub.URLFetchServiceStub()) 

from google.appengine.api import urlfetch
urlfetch.fetch('http://www.google.co.jp').status_code


Popularity: 5% [?]

  • Digg
  • Google Bookmarks
  • Google Reader
  • Facebook
  • Delicious
  • FriendFeed
  • Evernote
  • Twitter
  • Share/Bookmark
  1. No comments yet.

  1. No trackbacks yet.