<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Hello, World!">
<Require feature="opensocial-0.8" />
</ModulePrefs>
<Content type="html" view="canvas">
<![CDATA[
<script type="text/javascript">
gadgets.util.registerOnLoadHandler(function(){
location.href="http://xxx.appspot.com/?st=" + encodeURIComponent(shindig.auth.getSecurityToken());
});
</script>
]]>
</Content>
</Module>
sessionにsecurityTokenを保存して実行。
http://code.google.com/p/opensocial-python-client/wiki/HowToConnecting
http://code.google.com/p/opensocial-python-client/wiki/HowToSocialCalls
config = opensocial.ContainerConfig(
security_token='<put your security token here>'
server_rpc_base='http://path/to/rpc/base'
server_rest_base='http://path/to/rest/base'
container = opensocial.ContainerContext(config)
request = opensocial.FetchPersonRequest(user_id='@me')
response = container.send_request(request)
settings.pyでライブラリの追加
sys.path.append(os.path.join(os.path.dirname(__file__), 'lib', 'opensocial'))
こんなリクエストになっている。
http://app0.mixi-platform.com/social/data/people/@viewer
/@self?None=X%20Y&fields=%40id%2C%40nickname&opensocial_method=GET
stの部分がNone=でわたっている。
st = request.GET.get('st', '')
st = urllib.unquote(st).encode('raw_unicode_escape').decode('utf8')
logging.warn( st + "\n" )
config = opensocial.ContainerConfig(
security_token=st,
server_rest_base = 'http://app0.mixi-platform.com/social/data')
container = opensocial.ContainerContext(config)
user_id = '@viewer'
fields = ['@id','@nickname']
os_request = opensocial.FetchPersonRequest(user_id,fields)
person = container.send_request(os_request)
send_requestで403. you don't have permission to...
* はてなダイアリーキーワード:mixiアプリ