nchah / github-traffic-stats

Get statistics on web traffic to your GitHub repositories.
https://pypi.org/project/github-traffic-stats/
121 stars 31 forks source link

bad credentials error - with only traffic permission #1

Closed gowrisankar22 closed 7 years ago

gowrisankar22 commented 7 years ago

Hi ,

I have only traffic permission to one of the repisitory but dont have the repository permission, in that case how can i get the traffic-stats for that repository. could you pleae help?

Thanks for your help in advance

@nchah

BRs, Gowrisankar

nchah commented 7 years ago

Hi Gowrisankar,

If I understand your question correctly, I believe you're only able to get traffic-stats for the repositories or forks that you own.

gowrisankar22 commented 7 years ago

@nchah thanks a lot for your reply.. is there anyway to get the traffic from other repositories if i have permission to see only traffic ??

BRs, Gowrisankar

nchah commented 7 years ago

If you can see the traffic stats for a repository (any Repo > Graphs > Traffic) then this script should be able to get the stats as well. As long as you're an owner or collaborator (any Repo > Settings > Collaborators) of a repo you should see the traffic stats.

gowrisankar22 commented 7 years ago

@nchah thanks a lot first of all :) cool :) I got it now. it works with few errors.. can you please check ?

Date Views Unique visitors Totals 7 1 2017-01-05 7 1

Traceback (most recent call last): File "github-traffic-stats.py", line 187, in main(args.username, args.repo, args.save_csv) File "github-traffic-stats.py", line 176, in main store_csv(repo, traffic_response) File "github-traffic-stats.py", line 125, in store_csv with open(csv_file_name, 'a') as csvfile: IOError: [Errno 2] No such file or directory: 'data/2017-01-06-12h-45m-traffic-stats.csv'

how to check traffic to partcular time frame? for an example last two weeks.

BRs, Gowrisankar

nchah commented 7 years ago

No problem, glad to help!

Looks like the traceback is saying the CSV file couldn't be located in the "data" folder. Feel free to modify that line in the code accordingly.

I think it's a limitations with the GitHub API or traffic-stats itself. The API only returns traffic stats for the most recent ~2 weeks or so. I haven't looked into this any further when I last built this though so maybe the documentation has changed :)

gowrisankar22 commented 7 years ago

thank you :) ... you have been a great help