WebScriptsClient (version 0.0.1)
index
webscriptsclient.py

This package implements the "official" WebScripts client.
This package implements client for default WebScripts features.
 
~# python WebScriptsClient.py -v -u Admin -p Admin test http://127.0.0.1:8000/web/
 
~# python WebScriptsClient.py -v -u Admin -p Admin download -f "LICENSE.txt" "LICENSE.txt" http://127.0.0.1:8000/web/
~# python WebScriptsClient.py -v -u Admin -p Admin download -s -f "LICENSE.txt" "LICENSE.txt" http://127.0.0.1:8000/web/
~# python WebScriptsClient.py -v -u Admin -p Admin download -o test.txt -f "LICENSE.txt" "LICENSE.txt" http://127.0.0.1:8000/web/
 
-# python -c "print('test')" > test.txt
~# python WebScriptsClient.py -v -u Admin -p Admin upload -r 1000 -w 1000 -d 1000 -f test.txt test.txt http://127.0.0.1:8000/web/
~# python WebScriptsClient.py -v -u Admin -p Admin upload -6 -b -C -H -c dGVzdA== test.txt http://127.0.0.1:8000/web/
~# python -c "print('test')" | python WebScriptsClient.py -v -u Admin -p Admin upload test.txt http://127.0.0.1:8000/web/
 
~# python WebScriptsClient.py -v -u Admin -P request -s title -n Maurice -r request -c 500 http://127.0.0.1:8000/web/
 
~# python WebScriptsClient.py -v -A exec "test_config.py" http://127.0.0.1:8000/web/
~# python -c "print('test')" | python WebScriptsClient.py -v -u Admin -p Admin exec "test_config.py" -o test.txt -I http://127.0.0.1:8000/web/
~# python -c "print('test')" > test.txt
~# python WebScriptsClient.py -v -u Admin -p Admin exec "test_config.py" -I test.txt http://127.0.0.1:8000/web/
~# python WebScriptsClient.py -v -u Admin -p Admin exec "test_config.py --test test3 --test4 -t" -i "test1" "test2" http://127.0.0.1:8000/web/
 
~# python WebScriptsClient.py -v info http://127.0.0.1:8000/web/
~# python WebScriptsClient.py -a AdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdminAdmin info -a -c -d -s "test_config.py" "/auth/" http://127.0.0.1:8000/web/
 
>>> client = WebScriptsClient("http://127.0.0.1:8000/web/", username="user", password="pass", api_key="api key")
>>> client.auth()
>>> scripts = client.get_scripts(refresh=False)
>>> client.upload("upload.txt", open("upload.txt"), no_compression=False, is_base64=False, hidden=False, binary=False, read_permissions=0, write_permissions=1000, delete_permissions=1000)
>>> file = client.download("upload.txt", save=True)
>>> client.request("Access", "I need access to test_config.py", "Maurice LAMBERT", error_code=500)
>>> arguments = client.args_command_to_webscripts(["--test", "test1", "test3"])
>>> inputs = client.args_command_to_webscripts(["--test", "test1", "test3"], is_inputs=True)
>>> for output, error, code in client.execute_script("test_config.py", arguments, inputs): print(output, end="")
>>> print(f"Error code: {code}")
>>> print(f"Error: {error}")

 
Classes
       
builtins.Exception(builtins.BaseException)
WebScriptsError
WebScriptsAuthenticationError
WebScriptsPermissionsError
WebScriptsScriptNotFoundError
builtins.object
WebScriptsClient

 
class WebScriptsAuthenticationError(WebScriptsError)
    
Method resolution order:
WebScriptsAuthenticationError
WebScriptsError
builtins.Exception
builtins.BaseException
builtins.object

Data descriptors inherited from WebScriptsError:
__weakref__
list of weak references to the object (if defined)

Methods inherited from builtins.Exception:
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.

Static methods inherited from builtins.Exception:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Methods inherited from builtins.BaseException:
__delattr__(self, name, /)
Implement delattr(self, name).
__getattribute__(self, name, /)
Return getattr(self, name).
__reduce__(...)
Helper for pickle.
__repr__(self, /)
Return repr(self).
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
__setstate__(...)
__str__(self, /)
Return str(self).
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.

Data descriptors inherited from builtins.BaseException:
__cause__
exception cause
__context__
exception context
__dict__
__suppress_context__
__traceback__
args

 
class WebScriptsClient(builtins.object)
    WebScriptsClient(url: str, username: str = None, password: str = None, api_key: str = None)
 
This class implements the "official" WebScripts client.
 
  Methods defined here:
__init__(self, url: str, username: str = None, password: str = None, api_key: str = None)
Initialize self.  See help(type(self)) for accurate signature.
auth(self, *args, **kwargs) -> None
This function requests the /auth/ script to get a API Token.
 
args and kwargs are sent to urllib.request.urlopen function.
download(self, filename: str, *args, save: bool = True, **kwargs) -> gzip.GzipFile
This function downloads a file from WebScripts server.
execute(self, path: str, arguments: Dict[str, ~Json], inputs: Dict[str, ~Json], *args, urlopen=<bound method OpenerDirector.open of <urllib.request.OpenerDirector object at 0x0000023668497FA0>>, **kwargs) -> http.client.HTTPResponse
This function executes a script and returns the response.
 
args and kwargs are sent to urllib.request.urlopen function.
execute_script(self, script_name: Union[WebScriptsClient.Script, str], arguments: Dict[str, ~Json], inputs: Dict[str, ~Json], *args, **kwargs) -> collections.abc.Iterator
This function requests a WebScripts script and returns output.
 
args and kwargs are sent to urllib.request.urlopen function.
get_real_time_output(self, key: str, data: Dict[str, ~Json], *args, **kwargs) -> collections.abc.Iterator
This function returns outputs of script with the "real time output"
WebScripts feature.
 
args and kwargs are sent to urllib.request.urlopen function.
get_scripts(self, *args, refresh: bool = False, **kwargs) -> List[WebScriptsClient.Script]
This function requests WebScripts API to build Scripts and Arguments.
request(self, title: str, request: str, name: str, error_code: int = 0) -> None
This function send a request or report to the WebScripts
Administrator.
upload(self, filename: str, file: Union[_io.TextIOWrapper, _io.BytesIO, bytes], *args, no_compression: bool = None, is_base64: bool = None, hidden: bool = None, binary: bool = None, read_permissions: int = None, write_permissions: int = None, delete_permissions: int = None, **kwargs) -> None
This function uploads a file on WebScripts server.

Static methods defined here:
args_command_to_webscripts(arguments: List[str], is_inputs: bool = False) -> Dict[str, ~Json]
This function returns WebScripts arguments from
command line arguments (List[str]).

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class WebScriptsError(builtins.Exception)
    
Method resolution order:
WebScriptsError
builtins.Exception
builtins.BaseException
builtins.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from builtins.Exception:
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.

Static methods inherited from builtins.Exception:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Methods inherited from builtins.BaseException:
__delattr__(self, name, /)
Implement delattr(self, name).
__getattribute__(self, name, /)
Return getattr(self, name).
__reduce__(...)
Helper for pickle.
__repr__(self, /)
Return repr(self).
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
__setstate__(...)
__str__(self, /)
Return str(self).
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.

Data descriptors inherited from builtins.BaseException:
__cause__
exception cause
__context__
exception context
__dict__
__suppress_context__
__traceback__
args

 
class WebScriptsPermissionsError(WebScriptsError)
    
Method resolution order:
WebScriptsPermissionsError
WebScriptsError
builtins.Exception
builtins.BaseException
builtins.object

Data descriptors inherited from WebScriptsError:
__weakref__
list of weak references to the object (if defined)

Methods inherited from builtins.Exception:
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.

Static methods inherited from builtins.Exception:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Methods inherited from builtins.BaseException:
__delattr__(self, name, /)
Implement delattr(self, name).
__getattribute__(self, name, /)
Return getattr(self, name).
__reduce__(...)
Helper for pickle.
__repr__(self, /)
Return repr(self).
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
__setstate__(...)
__str__(self, /)
Return str(self).
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.

Data descriptors inherited from builtins.BaseException:
__cause__
exception cause
__context__
exception context
__dict__
__suppress_context__
__traceback__
args

 
class WebScriptsScriptNotFoundError(WebScriptsError)
    
Method resolution order:
WebScriptsScriptNotFoundError
WebScriptsError
builtins.Exception
builtins.BaseException
builtins.object

Data descriptors inherited from WebScriptsError:
__weakref__
list of weak references to the object (if defined)

Methods inherited from builtins.Exception:
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.

Static methods inherited from builtins.Exception:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Methods inherited from builtins.BaseException:
__delattr__(self, name, /)
Implement delattr(self, name).
__getattribute__(self, name, /)
Return getattr(self, name).
__reduce__(...)
Helper for pickle.
__repr__(self, /)
Return repr(self).
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
__setstate__(...)
__str__(self, /)
Return str(self).
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.

Data descriptors inherited from builtins.BaseException:
__cause__
exception cause
__context__
exception context
__dict__
__suppress_context__
__traceback__
args

 
Data
        __all__ = ['WebScriptsClient', 'WebScriptsError', 'WebScriptsPermissionsError', 'WebScriptsScriptNotFoundError', 'WebScriptsAuthenticationError']
__annotations__ = {'authopener': <class 'collections.abc.Callable'>, 'logger': <class 'logging.Logger'>, 'logger_critical': <class 'collections.abc.Callable'>, 'logger_debug': <class 'collections.abc.Callable'>, 'logger_error': <class 'collections.abc.Callable'>, 'logger_info': <class 'collections.abc.Callable'>, 'logger_warning': <class 'collections.abc.Callable'>, 'opener': <class 'urllib.request.OpenerDirector'>, 'urlopen': <class 'collections.abc.Callable'>}
__author_email__ = 'mauricelambert434@gmail.com'
__copyright__ = '\nWebScriptsClient Copyright (C) 2022 Maurice L...ome to redistribute it\nunder certain conditions.\n'
__description__ = '\nThis package implements the "official" WebScrip...plements client for default WebScripts features.\n'
__license__ = 'GPL-3.0 License'
__maintainer__ = 'Maurice Lambert'
__maintainer_email__ = 'mauricelambert434@gmail.com'
__url__ = 'https://github.com/mauricelambert/WebScriptsClient'

 
Author
        Maurice Lambert