python的rest客户机
napper的Python项目详细描述
#打盹儿
异步的rest框架。
目前处于实验阶段。使用风险自负。
importasynciofromnapperimportapisasyncdefgetstargazers():"""Print the most popular repository of the authors of the most recent gists from github."""withapis.github()asgithub:gists=github.gists.get()asyncforgistingists:try:repo=awaitgist.owner.repos_url.get()[0]exceptAttributeError:print("{0.id}: Gist has no owner".format(gist))continueexceptIndexError:print("{0.id}: {0.owner.login} has no repositories".format(gist))continueprint("{0.id}: {0.owner.login} {1.name} {1.stargazers_count}".format(gist,repo))loop=asyncio.get_event_loop()loop.run_until_complete(getstargazers())