client in api, slightl more robust client

This commit is contained in:
Ville Rantanen
2018-04-18 10:02:59 +03:00
parent 7edab27351
commit 5201f215b5
2 changed files with 65 additions and 28 deletions

View File

@@ -368,13 +368,16 @@ def print_rest_api(shares, config, opts):
print_rest_api_direct(config, share, token, opts.filename)
elif opts.type == "zip":
print_rest_api_zip(config, share, token)
elif opts.type == "client":
print_rest_api_client(config, share, token)
def print_rest_api_list(config, share):
print("Link to enter the share:")
print("%s/list/%s"%(
def print_rest_api_client(config, share, token):
print("Command to run python client:")
print("python <( %s/script/client/%s/%s )"%(
config['public_url'],
share['name']
share['name'],
token
))
@@ -386,28 +389,11 @@ def print_rest_api_login(config, share, token):
token
))
def print_rest_api_upload(config, share, token):
if 'upload' not in share or not share['upload']:
print("Uploading not allowed to this share")
sys.exit(0)
print("Link to upload file to the share:")
print("\n# curl -F file=@'the_file_name.ext' %s/upload/%s/%s"%(
def print_rest_api_list(config, share):
print("Link to enter the share:")
print("%s/list/%s"%(
config['public_url'],
share['name'],
token
))
print("\nLink to upload multiple files to the share:")
print("\n# curl -s %s/script/upload/%s/%s | bash /dev/stdin file_to_upload.ext [second.file.ext]"%(
config['public_url'],
share['name'],
token
))
print("\nLink to upload multiple files to the share, splitting large files:")
print("\n# curl -s %s/script/upload_split/%s/%s | python - [-s split_size_in_Mb] file_to_upload.ext [second.file.ext]"%(
config['public_url'],
share['name'],
token
share['name']
))
@@ -473,6 +459,30 @@ def print_rest_api_direct(config, share, token, show_filename):
))
def print_rest_api_upload(config, share, token):
if 'upload' not in share or not share['upload']:
print("Uploading not allowed to this share")
sys.exit(0)
print("Link to upload file to the share:")
print("\n# curl -F file=@'the_file_name.ext' %s/upload/%s/%s"%(
config['public_url'],
share['name'],
token
))
print("\nLink to upload multiple files to the share:")
print("\n# curl -s %s/script/upload/%s/%s | bash /dev/stdin file_to_upload.ext [second.file.ext]"%(
config['public_url'],
share['name'],
token
))
print("\nLink to upload multiple files to the share, splitting large files:")
print("\n# curl -s %s/script/upload_split/%s/%s | python - [-s split_size_in_Mb] file_to_upload.ext [second.file.ext]"%(
config['public_url'],
share['name'],
token
))
def print_rest_api_zip(config, share, token):
print("ZIP download:")
print("%s/zip/%s/%s"%(