{"id":20292480,"url":"https://github.com/mauricelambert/webscriptstools","last_synced_at":"2025-10-25T06:49:11.330Z","repository":{"id":62588618,"uuid":"445936805","full_name":"mauricelambert/WebScriptsTools","owner":"mauricelambert","description":"This package implements tools for WebScripts Scripts.","archived":false,"fork":false,"pushed_at":"2023-10-27T20:24:02.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T07:41:36.871Z","etag":null,"topics":["cli","pypi-package","python3","tools","webscripts"],"latest_commit_sha":null,"homepage":"https://webscripts.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mauricelambert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-08T21:55:14.000Z","updated_at":"2024-08-12T20:19:36.000Z","dependencies_parsed_at":"2022-11-03T21:38:35.127Z","dependency_job_id":null,"html_url":"https://github.com/mauricelambert/WebScriptsTools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricelambert%2FWebScriptsTools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricelambert%2FWebScriptsTools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricelambert%2FWebScriptsTools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricelambert%2FWebScriptsTools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mauricelambert","download_url":"https://codeload.github.com/mauricelambert/WebScriptsTools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248382134,"owners_count":21094541,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","pypi-package","python3","tools","webscripts"],"created_at":"2024-11-14T15:17:28.011Z","updated_at":"2025-10-25T06:49:11.246Z","avatar_url":"https://github.com/mauricelambert.png","language":"Python","readme":"![WebScripts Logo](https://mauricelambert.github.io/info/python/code/WebScripts/small_logo.png \"WebScripts logo\")\r\n\r\n# WebScriptsTools\r\n\r\n## Description\r\n\r\nThis package implements tools for WebScripts Scripts.\r\n\r\n## Requirements\r\n\r\nThis package require:\r\n\r\n - python3\r\n - python3 Standard Library\r\n\r\n## Installation\r\n\r\n```bash\r\npip install WebScriptsTools\r\n```\r\n\r\n## Usages\r\n\r\n### Command line\r\n\r\n#### Module\r\n\r\n```bash\r\n# These command lines should be launch in a WebScripts Scripts Environment !\r\n\r\npython3 -m WebScriptsTools\r\npython3 -m WebScriptsTools get_log_file\r\npython3 -m WebScriptsTools get_upload_script\r\npython3 -m WebScriptsTools get_webscripts_data_path\r\n```\r\n\r\nIf you run these command lines outside the WebScripts scripting environment, you get this error:\r\n```text\r\nTypeError: the JSON object must be str, bytes or bytearray, not NoneType\r\n```\r\n\r\nExample of usage in a script bash:\r\n```bash\r\nlogfile=$(python3 -m WebScriptsTools get_log_file)\r\necho \"DEBUG: Get log file from WebScriptsTools\" \u003e \"${logfile}\"\r\ncat \"$(python3 -m WebScriptsTools get_webscripts_data_path)/datafile.txt\"\r\necho \"INFO: print data using WebScripts data directory\" \u003e \"${logfile}\"\r\ncat myfile.txt | \"$(python3 -m WebScriptsTools get_upload_script)\" uploaded_filename.txt\r\ncat myfile.txt | \"$(python3 -m WebScriptsTools get_upload_script)\" -r 1000 -w 1000 -d 1000 -H -b -c -i uploaded_filename.txt\r\n```\r\n\r\n### Python script\r\n\r\n```python\r\n# To use this module you should be in a WebScripts Scripts Environment\r\n\r\nfrom WebScriptsTools import *\r\n\r\nset_excepthook() # manage exceptions without printing sensible informations\r\n\r\n# Get the upload module, to read, delete or write a shared file\r\nupload = get_upload_module()\r\nupload.get_file(\"my_webscripts_shared_file.txt\")\r\n\r\n# Use the data path to change databases\r\nwith open(f\"{get_webscripts_data_path()}/datafile.txt\") as datafile:\r\n    print(datafile.read())\r\n\r\n# Get the log file to configure your logger or read your logs\r\nlogs = open(get_log_file())\r\nlog = logs.readline()\r\nwhile log:\r\n    print(log)\r\n    log = logs.readline()\r\n\r\n# Get the user to check permission or get informations like ID or name\r\nuser = get_user()\r\nprint(f\"You are named '{user['name']}' here !\")\r\n\r\nclass ClassModule:\r\n    @module2to3\r\n    def method(\r\n        self,\r\n        environ,\r\n        user,\r\n        configuration,\r\n        filename,\r\n        commande,\r\n        inputs,\r\n        csrf_token: str = None,\r\n    ) -\u003e Tuple[str, Dict[str, str], bytes]:\r\n        return \"200 OK\", {}, b'data'\r\n\r\n@module2to3\r\ndef function(\r\n    environ,\r\n    user,\r\n    configuration,\r\n    filename,\r\n    commande,\r\n    inputs,\r\n    csrf_token: str = None,\r\n) -\u003e Tuple[str, Dict[str, str], bytes]:\r\n    return \"200 OK\", {}, b'data'\r\n```\r\n\r\n## Links\r\n\r\n - [Github Page](https://github.com/mauricelambert/WebScriptsTools/)\r\n - [Documentation](https://mauricelambert.github.io/info/python/code/WebScriptsTools.html)\r\n - [Pypi package](https://pypi.org/project/WebScriptsTools/)\r\n\r\n## Licence\r\n\r\nLicensed under the [GPL, version 3](https://www.gnu.org/licenses/).\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauricelambert%2Fwebscriptstools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmauricelambert%2Fwebscriptstools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauricelambert%2Fwebscriptstools/lists"}