Skip to content

Commit fccee61

Browse files
committed
Resovled requested changes
1 parent 4e2777a commit fccee61

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

Python/Github_Traffic/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This script, can help one determine all the unique viewers on his/her Repository.
44
By using `access-token` one can determine the viewers and number of time they viewed the Repo.
55
Currently data of only 14 days is possible (limitation of GitHib-API), but in future by using the GraphQL queries, this limitation can be answered.
6-
Te script uses PickleDB, the data can be imported in CSV as well, although the functionality hasn't been added till this point of time.
6+
The script uses PickleDB, the data can be imported in CSV as well, although the functionality hasn't been added till this point of time.
77

88
## Note
99

@@ -20,12 +20,12 @@ These are summarised in `requirement.txt`
2020

2121
## Setup
2222

23-
1. A virtual environment (recommended)
24-
1. `pip install -r requirements.txt`
25-
1. Generate your own access token from [here](https://github.com/settings/tokens) (If you already have one with `repo` rights, it can be used as well)
26-
1. It is recommended to paste this token somewhere, as one cant review it again.
27-
1. Determine the Repository whose traffic you want to view.
28-
1. Run the Script
23+
- A virtual environment (recommended)
24+
- `pip install -r requirements.txt`
25+
- Generate your own access token from [here](https://github.com/settings/tokens) (If you already have one with `repo` rights, it can be used as well)
26+
- It is recommended to paste this token somewhere, as one cant review it again.
27+
- Determine the Repository whose traffic you want to view.
28+
- Run the Script
2929

3030
## Usage
3131

Python/Github_Traffic/github_traffic.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,18 @@
44
import argparse
55
import sys
66

7-
# Collect Information for Databse
7+
88
def collect(user, repo, token, org):
9+
"""
10+
Function for Collection of Data.
11+
Counts the total number of views (Unique and total) on a Repo.
12+
13+
Parameters:
14+
user (str): The Github Username
15+
repo (str): The Name of Repo
16+
token (str): The Personal Access Token
17+
org (str): The Name of Organization [Optional]
18+
"""
919
if org is None:
1020
org = user
1121

@@ -45,6 +55,12 @@ def collect(user, repo, token, org):
4555

4656

4757
def view(repo):
58+
"""
59+
Function for viewing the Results obtained in the collect function
60+
61+
Parameters:
62+
repo (str): Name of the Repo
63+
"""
4864
db = __load_db(repo=repo)
4965
timestamps = db.getall()
5066
for ts in sorted(timestamps):
@@ -53,6 +69,13 @@ def view(repo):
5369

5470

5571
def __load_db(repo):
72+
"""
73+
The attribute to Load the information present in the Database
74+
75+
Parameters:
76+
repo (str): The name of the Repo
77+
"""
78+
5679
return pickledb.load('{repo}_views.db'.format(repo=repo), False)
5780

5881

@@ -80,4 +103,4 @@ def main():
80103

81104

82105
if __name__ == "__main__":
83-
main()
106+
main()

0 commit comments

Comments
 (0)