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

import_issues attribute error #2

Open
pgorod opened this issue Jul 6, 2018 · 2 comments
Open

import_issues attribute error #2

pgorod opened this issue Jul 6, 2018 · 2 comments

Comments

@pgorod
Copy link

pgorod commented Jul 6, 2018

Hi, I'm trying out your script and I get this error when I try to import issues:

/var/www/github-issue-counter $ ./import_issues.py
Traceback (most recent call last):
  File "./import_issues.py", line 24, in <module>
    for i in gh.iter_repo_issues(ORG, REPO, state='all'):
  File "/usr/local/lib/python2.7/dist-packages/github3/models.py", line 58, in __getattr__
    raise AttributeError(attribute)
AttributeError: iter_repo_issues

Maybe I didn't use the correct GitHub Key, I wish you had more detailed steps to get it. I wen tinto my Gihub user's settings page (not the repo's settings page) and made a personal token with plenty of accesses.

Can you help me troubleshoot please? Thanks for your script!

@MorrisJobke
Copy link
Owner

Good question - could also be, that the dependency was updated and thus it doesn't work anymore 🙈

@chrisjbillington
Copy link

The script is a little out of date, but is not too hard to get something similar up and running. Here's an example:

#!/usr/bin/env python

import github3
import pandas as pd

GITHUB_TOKEN = 'MY_TOKEN'
ORG = 'SOME_ORG'
REPO = 'SOME_REPO'

FILENAME_ISSUES = f'{ORG}.{REPO}.issues.csv'

gh = github3.login(token=GITHUB_TOKEN)

issues = []
for i, issue in enumerate(gh.issues_on(ORG, REPO, state='all')):
    issues.append({'closed': issue.is_closed(), 'created': issue.created_at})
    print(f'got {i} issues...')

df = pd.DataFrame(issues)
with open(FILENAME_ISSUES, 'w') as f:
    f.write(df.to_csv())

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

3 participants