github-issue-counter icon indicating copy to clipboard operation
github-issue-counter copied to clipboard

import_issues attribute error

Open pgorod opened this issue 7 years ago • 2 comments

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!

pgorod avatar Jul 06 '18 10:07 pgorod

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

MorrisJobke avatar Jul 06 '18 11:07 MorrisJobke

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())

chrisjbillington avatar Feb 11 '19 20:02 chrisjbillington