Skip to main content

A REST client for Python

Project description

# napper

A REST framework for asyncio.

Currently in experimental stage. Use at your own risk.

import asyncio

from napper import apis

async def getstargazers():
    """Print the most popular repository of the authors of
    the most recent gists from github."""
    with apis.github() as github:
        gists = github.gists.get()
        async for gist in gists:
            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())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

napper-0.1a1.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distribution

napper-0.1a1-py2.py3-none-any.whl (11.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page