amirtoole / async-exercise

A coding exercise for Twisted or asyncio (for "async-history" session)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PyYYC: Async Web Client

This is a skeleton for a programming assignment to explore an asynchronous Web client written using Twisted or asyncio.

Must use Python3.

Getting Started

To create a virtualenv and install all requirements:

python3 -m venv venv3
source venv3/bin/activate
python3 -m pip install -r requirements.txt

This will install both treq and aiohttp.

Start with either main_tx.py or main_aio.py depending upon whether you want to use Twisted or asyncio (if you finish, try the other framework).

The Assignment

  1. Refactor: make a async def fetch(url) function

  2. List all py-yyc repos

  1. discover the SHA1 of the most-recent commit of each repo
  1. bonus: use authentication

  2. bonus: determine wall-clock run-time of your program (compare between parallel / non-parallel if you can)

Note: without logging in, it's possible we'll hit the rate-limits. If that happens, you can use these URIs instead:

For "py-yyc/repos" endpoint:

https://raw.githubusercontent.com/py-yyc/async-exercise/master/data/repos.json

For "{repo}/commits" endpoint:

https://raw.githubusercontent.com/py-yyc/async-exercise/master/data/{repo}_commits.json

...so for the "todos_app" repository that would be: https://raw.githubusercontent.com/py-yyc/async-exercise/master/data/todos_app_commits.json

About

A coding exercise for Twisted or asyncio (for "async-history" session)


Languages

Language:Python 100.0%