2012-04-12 72 views
4

如何從python腳本發出認證請求以進行appengine?我在網上發現了很多不同的方法,但都沒有成功。 E.G. How do you access an authenticated Google App Engine service from a (non-web) python client?不起作用,請求返回登錄頁面。 該帖子很舊,可能從那時起就有所變化。 有沒有人有一個很好的包裝對象來做到這一點?如何通過腳本對appengine進行身份驗證請求?

+0

你應該張貼你的答案作爲答案,然後接受它。 – 2012-04-13 05:11:35

+0

done @NickJohnson謝謝! – user683264 2012-04-15 02:51:39

回答

1

拉出隊列回答我自己的問題一個非Web認證的Python客戶端使得在Python客戶端庫請求中的一個例子:

from google.appengine.tools import appengine_rpc 
use_production = True 
if use_production: 
    base_url = 'myapp.appspot.com' 
else: 
    base_url = 'localhost:8080' 


def passwdFunc(): 
    return ('[email protected]','password') 

def main(argv): 
    rpcServer = appengine_rpc.HttpRpcServer(base_url, 
              passwdFunc, 
              None, 
              'myapp', 
              save_cookies=True, 
              secure=use_production) 
# Makes the actual call, I guess is the same for POST and GET? 
blah = rpcServer.Send('/some_path/') 

print blah 

if __name__ == '__main__': 
    main(sys.argv) 
+0

這是唯一的方法嗎?你不能通過向登錄網址發送請求來進行身份驗證嗎? – fccoelho 2014-05-03 20:35:10

+1

由於appengine_rpc使用ClientLogin(已被棄用和刪除)(請參閱https://developers.google.com/identity/protocols/AuthForInstalledApps),此操作不再有效。 – 2015-06-26 02:48:09

相關問題