Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 595b9b48 authored by jacquemier's avatar jacquemier
Browse files

Connect to webdav server

parent f10d546d
......@@ -11,10 +11,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": []
"source": [
"webdav = webdavacc.connect('lapp-xdc01.in2p3.fr', 'webdavuser', 'webdavuser', protocol='http')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[File(name='/', size=0, mtime='Fri, 04 Oct 2019 13:15:56 GMT', ctime='2019-10-04T13:15:56Z', contenttype='httpd/unix-directory'),\n",
" File(name='/test%20manual/', size=0, mtime='Fri, 04 Oct 2019 13:50:21 GMT', ctime='2019-10-04T13:50:21Z', contenttype='httpd/unix-directory')]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"webdav.ls()"
]
}
],
"metadata": {
......
from setuptools import setup
entry_points={
'console_scripts': [
'webdavacc = webdavacc:main',
],}
setup(name='webdavacc',
version='0.1',
description='webDav Access for LAPP accelerator Team',
......@@ -7,4 +13,6 @@ setup(name='webdavacc',
author='Jean Jacquemier',
author_email='jacquem@lapp.in2p3.fr',
license='CeCILL',
packages=['webdavacc'])
\ No newline at end of file
packages=['webdavacc'],
entry_points=entry_points,
)
\ No newline at end of file
......@@ -15,9 +15,21 @@ download(remote_path, local_path_or_fileobj)
'''
def INFO(text):
"""
Display text in green
Parameters
----------
test : string
test to display.
"""
green = lambda text: '\033[0;32m' + text + '\033[0m'
print(green(text))
def connect(server, username, password, protocol='https'):
"""WebDav Connection.
def connect(server, username, password, port =80, protocol='https'):
"""
WebDav Connection.
Parameters
----------
......@@ -27,32 +39,39 @@ def connect(server, username, password, protocol='https'):
WebDav username.
password : string
WebDav password.
protocol : port
webdav port default=80
protocol : string
webdav protocol default=https
cert : string default=None
Description of parameter.
Returns
-------
WebDav connection
easywebdav.client.Client
"""
return easywebdav.connect(server,
username,
password,
protocol)
if __name__ == '__main__':
username=username,
password=password,
protocol=protocol,
port=port)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("server")
parser.add_argument("--verbose", help="increase output verbosity",
action="store_true")
parser.add_argument("-u", "--username", help="username", required=True)
parser.add_argument("-p", "--password", help="password", required=True)
parser.add_argument("-t", "--port", help="username", required=False)
parser.add_argument("-c", "--protocol", help="protocol", required=False)
args = parser.parse_args()
if args.verbose:
print("verbosity turned on")
INFO('INFO::Connect to Webdav server[{}], username[{}], protocol[{' \
'}]'.format(args.server, args.username, args.protocol))
print(webdav.ls())#
\ No newline at end of file
if __name__ == '__main__':
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment