Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.db.base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.db.base
Commits
a77347c2
There was a problem fetching the pipeline summary.
Commit
a77347c2
authored
7 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Password is only required for upload to server
parent
8d383024
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!33
Implemented local file upload, closes #20
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/db/base/driver.py
+10
-7
10 additions, 7 deletions
bob/db/base/driver.py
with
10 additions
and
7 deletions
bob/db/base/driver.py
+
10
−
7
View file @
a77347c2
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment