feature: Add max days argument #4
+6
-1
@@ -13,6 +13,8 @@ URL_TRANSFERSH = 'https://transfer.sh'
|
||||
@click.command()
|
||||
@click.argument('filename')
|
||||
def transfersh_cli(filename):
|
||||
@click.option('-a', '--max-days', type=int, help='Maximum number of days to keep file')
|
||||
def transfersh_cli(filename, max_days, max_downloads):
|
||||
""" Program that uploads a file to Transfer.sh """
|
||||
try:
|
||||
# Open file
|
||||
@@ -20,7 +22,10 @@ def transfersh_cli(filename):
|
||||
click.echo('Uploading file')
|
||||
# Upload file
|
||||
conf_file = {filename: data}
|
||||
r = requests.post(URL_TRANSFERSH, files=conf_file)
|
||||
headers = {}
|
||||
if max_days is not None:
|
||||
headers['Max-Days'] = str(max_days)
|
||||
r = requests.post(URL_TRANSFERSH, files=conf_file, headers=headers)
|
||||
# Shows route to download
|
||||
download_url = r.text
|
||||
click.echo(f'Download from here: {download_url}')
|
||||
|
||||
Reference in New Issue
Block a user