Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TODO] Invent ways of checking how many attendees reached check points #4

Open
webknjaz opened this issue Sep 30, 2019 · 1 comment

Comments

@webknjaz
Copy link
Member

No description provided.

@webknjaz
Copy link
Member Author

import asyncio
import os
from pprint import pprint

from aiohttp.client import ClientSession
from octomachinery.github.api.tokens import GitHubOAuthToken
from octomachinery.github.api.raw_client import RawGitHubAPI


async def main():
    access_token = GitHubOAuthToken(os.environ['GITHUB_TOKEN'])
    async with ClientSession() as http_session:
        gh = RawGitHubAPI(
            access_token,
            session=http_session,
            user_agent='webknjaz',
        )
        print('=' * 50)
        print(' COMPLETED '.center(50, '='))
        print('=' * 50)
        async for issue_entry in gh.getiter(
            'https://api.github.com/repos/'
            'mariatta/strange-relationship/'
            'issues?'
            'state=closed&sort=created&'
            'since=2020-02-21T12:00:00Z',
        ):
            #print()
            print(
                f'@{issue_entry["user"]["login"]} #{issue_entry["number"]} '
                f'{issue_entry["title"]} '
                f'{issue_entry["created_at"]}{issue_entry["closed_at"]}',
            )
            #print()
            #pprint(issue_entry)

        print()
        print('=' * 50)
        print(' STUCK '.center(50, '='))
        print('=' * 50)
        async for issue_entry in gh.getiter(
            'https://api.github.com/repos/'
            'mariatta/strange-relationship/'
            'issues?'
            'state=open&sort=created&'
            'since=2020-02-21T12:00:00Z',
        ):
            #print()
            print(
                f'@{issue_entry["user"]["login"]} #{issue_entry["number"]} '
                f'{issue_entry["title"]} '
                f'{issue_entry["created_at"]}',
            )
            #print()
            #pprint(issue_entry)


asyncio.run(main())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant