Skip to content

epsy/napper

Repository files navigation

napper

Join the chat at https://gitter.im/epsy/napper https://travis-ci.org/epsy/napper.svg?branch=master https://coveralls.io/repos/github/epsy/napper/badge.svg?branch=master

A REST framework for asyncio.

Currently in experimental stage. Use at your own risk.

import asyncio

from napper.apis import github

async def getstargazers():
    """Print the most popular repository of the authors of
    the most recent gists from github."""
    async with github() as site:
        async for gist in site.gists.get():
            try:
                repo = await gist.owner.repos_url.get()[0]
            except AttributeError:
                print("{0.id}: Gist has no owner".format(gist))
                continue
            except IndexError:
                print("{0.id}: {0.owner.login} has no repositories".format(gist))
                continue
            print("{0.id}: {0.owner.login} {1.name} {1.stargazers_count}".format(
                gist, repo
                ))

loop = asyncio.get_event_loop()
loop.run_until_complete(getstargazers())

About

A REST client for Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published