Skip to content

Commit 14fe409

Browse files
authored
add api key support
1 parent 337b3f1 commit 14fe409

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ $ octodir
2525
* **Example:** `https://github.com/Jalkhov/octodir/tree/stable/octodir`
2626
* **Output folder**: Absolute path of the output directory
2727
* You can enter a dot to download in the current working directory
28+
* **API key**: Personal Github Token for prevent requests limit
2829

2930
## In code
3031

@@ -33,8 +34,9 @@ from octodir import Octodir
3334

3435
target = 'https://github.com/Jalkhov/Octodir/tree/stable/octodir'
3536
folder = '.' # Current working directory
37+
api_key = '<PERSONAL_GITHUB_TOKEN>'
3638

37-
Octo = Octodir(target, folder)
39+
Octo = Octodir(target, folder, api_key=api_key)
3840
Octo.dowload_folder()
3941
```
4042

octodir/octodir_cli.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
@click.command()
66
@click.option("--folder_url", prompt="Full folder url", help="Full url from the folder to download")
77
@click.option("--output_folder", prompt="Output folder", help="Folder where files will be downloaded")
8-
def octodir_cli(folder_url, output_folder):
9-
x = Octodir(folder_url, output_folder)
8+
@click.option("--api-key", prompt=True, hide_input=True, help="API key for authentication")
9+
def octodir_cli(folder_url, output_folder, api_key):
10+
x = Octodir(folder_url, output_folder, api_key)
1011
x.dowload_folder()
1112

1213

0 commit comments

Comments
 (0)