Skip to content
Snippets Groups Projects
Unverified Commit cc3e6691 authored by Daniel's avatar Daniel
Browse files

DOC: Documentation.

parent 914b912d
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
# #
"""unauthenticated. """unauthenticated.
An Authentictor which suppresses any authentication and also ignores auth_token An Authenticator which suppresses any authentication and also ignores auth_token
cookies. cookies.
""" """
from __future__ import absolute_import, unicode_literals, print_function from __future__ import absolute_import, unicode_literals, print_function
......
...@@ -291,7 +291,8 @@ USAGE ...@@ -291,7 +291,8 @@ USAGE
"`password_method` of the connection is set to " "`password_method` of the connection is set to "
"`auth_token` and the respective configuration " "`auth_token` and the respective configuration "
"from the pycaosdb.ini is effectively being " "from the pycaosdb.ini is effectively being "
"overridden.")) "overridden.\nTODO: Also allow passing the token "
"via environmenty variables."))
subparsers = parser.add_subparsers( subparsers = parser.add_subparsers(
title="commands", title="commands",
metavar="COMMAND", metavar="COMMAND",
......
...@@ -34,6 +34,12 @@ from caosdb.connection.encode import MultipartParam, multipart_encode ...@@ -34,6 +34,12 @@ from caosdb.connection.encode import MultipartParam, multipart_encode
def _make_params(pos_args, opts): def _make_params(pos_args, opts):
"""Create and return option string components.
The return value is a dict with be something like `-O<key>`:`<value>` from `opts` and
`-p{0,1,2,3,...}`:`<value>` from `pos_args`.
"""
result = {} result = {}
for key, val in opts.items(): for key, val in opts.items():
result["-O{key}".format(key=key)] = str(val) result["-O{key}".format(key=key)] = str(val)
...@@ -43,6 +49,8 @@ def _make_params(pos_args, opts): ...@@ -43,6 +49,8 @@ def _make_params(pos_args, opts):
def _make_multipart_request(call, pos_args, opts, files): def _make_multipart_request(call, pos_args, opts, files):
"""Return body and header for an HTTP request.
"""
parts = list() parts = list()
params = _make_params(pos_args, opts) params = _make_params(pos_args, opts)
...@@ -59,6 +67,7 @@ def _make_multipart_request(call, pos_args, opts, files): ...@@ -59,6 +67,7 @@ def _make_multipart_request(call, pos_args, opts, files):
def _make_form_request(call, pos_args, opts): def _make_form_request(call, pos_args, opts):
"""Return URL from call and argumewnts, and headers for urlencoding."""
form = dict() form = dict()
form["call"] = call form["call"] = call
...@@ -73,6 +82,8 @@ def _make_form_request(call, pos_args, opts): ...@@ -73,6 +82,8 @@ def _make_form_request(call, pos_args, opts):
def _make_request(call, pos_args, opts, files=None): def _make_request(call, pos_args, opts, files=None):
""" """
Multipart if with files, otherwise url-encoded.
Return Return
------ ------
path_segments, body, headers path_segments, body, headers
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
# #
# Copyright (C) 2018 Research Group Biomedical Physics, # Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen # Max-Planck-Institute for Dynamics and Self-Organization Göttingen
# Copyright (C) 2020 Indiscale GmbH <info@indiscale.com>
# Copyright (C) 2020 Timm Fitschen <f.fitschen@indiscale.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment