简单的 REST api 包装器
项目描述
介绍
使用 rieapie 访问 google maps rest api 的示例。
import rieapie
gmap = rieapie.Api("http://maps.googleapis.com/maps/api")
args = {
"origin" : "Toronto"
,"destination" : "Montreal"
,"avoid" : "highways"
,"mode" : "bicycling"
,"sensor" : "false"
}
directions = gmap.directions.json.get(**args)
print directions["routes"][0]["bounds"]
使用提供的 twitter 包装器访问 twitter api 的示例。
import rieapie
params = {
"consumer_key" : "..."
,"consumer_secret" : "..."
}
# or if you want to provide an access token
params = {
"consumer_key" : "..."
,"consumer_secret" : "..."
,"access_token" : "..",
,"access_token_secret" : ".."
}
twitter = rieapie.wrappers.Twitter( **params )
timeline = twitter.statuses.user_timeline(ext="json")
# or if you prefer this syntax
timeline = twitter.statuses["user_timeline.json"]
for status in timeline.get(count=10, screen_name="mybestfriend"):
print status['text']
为什么是“rieapie”?
[ R ]est [ i ]s [ E ]asy [ a ]s [ P ]ython [ i ]s [ E ]asy
[ R ]est [ i ]s [ E ]asy [ a ]s [ PIE ]
[ R ]est [ i ]s [ E ]asy [ API ]…[ E ]asy
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
rieapie-0.0.7.3.tar.gz
(5.2 kB
查看哈希)
内置分布
rieapie-0.0.7.3-py2.7.egg
(10.3 kB
查看哈希)