Skip to content
Snippets Groups Projects
Commit a77347c2 authored by Manuel Günther's avatar Manuel Günther
Browse files

Password is only required for upload to server

parent 8d383024
No related branches found
No related tags found
1 merge request!33Implemented local file upload, closes #20
Pipeline #
......@@ -86,13 +86,6 @@ def upload(arguments):
import shutil
parsed_url = six.moves.urllib.parse.urlparse(arguments.destination)
target_path = '/'.join((parsed_url.path, arguments.name + ".tar.bz2"))
# encode user/pass to DAV server before we start
password = getpass.getpass(prompt='Password for Bob\'s "uploader": ')
password = password.encode('ascii')
upass = base64.encodestring(b'uploader:%s' % password).decode('ascii')[:-1]
headers = {'Authorization': 'Basic %s' % upass}
with tempfile.TemporaryFile() as tmpfile:
......@@ -120,6 +113,16 @@ def upload(arguments):
# maybe no file location? try next steps
print("Seems not to be a file location; Exception is as follows: %s" % e)
# print what we are going to do
target_path = '/'.join((parsed_url.path, arguments.name + ".tar.bz2"))
print("Uploading protocol files to server %s"%target_path)
# encode user/pass to DAV server before we start
password = getpass.getpass(prompt='Password for Bob\'s "uploader": ')
password = password.encode('ascii')
upass = base64.encodestring(b'uploader:%s' % password).decode('ascii')[:-1]
headers = {'Authorization': 'Basic %s' % upass}
if parsed_url.scheme == 'https':
dav_server = six.moves.http_client.HTTPSConnection(parsed_url.netloc)
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment