feat: Add max downloads #5
@@ -13,6 +13,7 @@ URL_TRANSFERSH = 'https://transfer.sh'
|
|||||||
@click.command()
|
@click.command()
|
||||||
@click.argument('filename')
|
@click.argument('filename')
|
||||||
@click.option('-a', '--max-days', type=int, help='Maximum number of days to keep file')
|
@click.option('-a', '--max-days', type=int, help='Maximum number of days to keep file')
|
||||||
|
@click.option('-d', '--max-downloads', type=int, help='Maximum number of times that file can be downloaded')
|
||||||
def transfersh_cli(filename, max_days, max_downloads):
|
def transfersh_cli(filename, max_days, max_downloads):
|
||||||
""" Program that uploads a file to Transfer.sh """
|
""" Program that uploads a file to Transfer.sh """
|
||||||
try:
|
try:
|
||||||
@@ -24,6 +25,8 @@ def transfersh_cli(filename, max_days, max_downloads):
|
|||||||
headers = {}
|
headers = {}
|
||||||
if max_days is not None:
|
if max_days is not None:
|
||||||
headers['Max-Days'] = str(max_days)
|
headers['Max-Days'] = str(max_days)
|
||||||
|
if max_downloads is not None:
|
||||||
|
headers['Max-Downloads'] = str(max_downloads)
|
||||||
r = requests.post(URL_TRANSFERSH, files=conf_file, headers=headers)
|
r = requests.post(URL_TRANSFERSH, files=conf_file, headers=headers)
|
||||||
# Shows route to download
|
# Shows route to download
|
||||||
download_url = r.text
|
download_url = r.text
|
||||||
|
|||||||
Reference in New Issue
Block a user