cookpan001 / vdisk

SDK For Vdisk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python SDK For Vdisk

Vdisk Documentation

http://vdisk.weibo.com/developers/index.php?module=api&action=apidoc

Usage

Get the authorization url. ###
from vdisk import OAuth2
oauth = OAuth2(WEIPAN_APPKEY,WEIPAN_APPSECRET,WEIPAN_CALLBACK)
url = oauth.authorize()

In the callback url.

oauth = OAuth2(WEIPAN_APPKEY,WEIPAN_APPSECRET,WEIPAN_CALLBACK)
#get request parameters using web.py framework
i = web.input()
if i.code.isdigit() and int(i.code) == 21330:
    return i.msg
try:
    return oauth.access_token(code = i.code)

Request for data using access_token.

obj = Client()
return obj.account_info(access_token)

All the responses will be a Response object(defined in vdisk.py). When download file using files(GET),developers should do this

for content in Response.data():
    #you can print content,or save content in a file.

Example

1. Get access_token request for this url: http://pzhu001.sinaapp.sina.com/auth after authorization you will get access_token 2.

Then request for vdisk api using access_token

account/info

http://pzhu001.sinaapp.com/2/account/info?access_token=f9c6606661ckiME21a9PM3CSQkI60b0a

metadata

In this example,parameter path has to be passed by GET method. root is set to basic.
http://pzhu001.sinaapp.com/2/metadata?access_token=f9c6606661ckiME21a9PM3CSQkI60b0a&path=/

About

SDK For Vdisk

License:Other


Languages

Language:Python 100.0%