{"id":31756729,"url":"https://github.com/ebay/clientwrapper","last_synced_at":"2025-10-09T19:22:50.486Z","repository":{"id":256288019,"uuid":"854706620","full_name":"eBay/clientwrapper","owner":"eBay","description":"Python library for CLI utility; only requires inheritance for basic argparse functionality \u0026 abstraction of boilerplate","archived":false,"fork":false,"pushed_at":"2024-09-13T23:40:26.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-09-23T13:58:47.912Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eBay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-09T16:31:54.000Z","updated_at":"2024-09-13T23:40:29.000Z","dependencies_parsed_at":"2024-09-10T02:37:02.102Z","dependency_job_id":"97196135-f323-43fd-bed5-8d09ee4842e9","html_url":"https://github.com/eBay/clientwrapper","commit_stats":null,"previous_names":["ebay/clientwrapper"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eBay/clientwrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eBay%2Fclientwrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eBay%2Fclientwrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eBay%2Fclientwrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eBay%2Fclientwrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eBay","download_url":"https://codeload.github.com/eBay/clientwrapper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eBay%2Fclientwrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001978,"owners_count":26083243,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-10-09T19:22:48.747Z","updated_at":"2025-10-09T19:22:50.481Z","avatar_url":"https://github.com/eBay.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clientwrapper (licensed under Apache 2.0)\nUtil class enabled CLI/dictionary syntax: allows separation of concerns between CLI and Python code.\n\n## installation\n```bash\npip install clientwrapper\n```\n\n## usage \n### overview\nClientWrapper is a class that allows you to define functions that can be run in both CLI and Python syntax.\n\n### run in CLI\nRunning as a CLI requires all functions with arguments to run in one combined function. The below command will not run as a CLI.\n```bash\npython3 -m yourmodule authenticate --arg1 value1 --arg2 value2\n# self.attributes like authentication tokens are erased every time the CLI is run; combine your functions to avoid NullPointerExceptions\npython3 -m yourmodule query --argument value # will not work: relying on any attributes in self\n```\nBelow is an example of how to run as a CLI.\n```bash\npython3 -m yourmodule authenticate_and_query --arg1 value1 --arg2 value2 --argument value\n```\n\n### usage example\nDefine your class here and inherit from ClientWrapper; combined function is required to run as a CLI.\n```python\nclass Impl(ClientWrapper):\n    def __init__(self):\n        super().__init__(\"Some API Requests\")\n\n    def login(self, username, password):\n        print(\"login called with username: \" + username + \" and password: \" + password)\n\n    def getRequest(self, argument):\n        print(\"getRequest called with argument: \" + argument)\n\n    def postRequest(self, **kwargs):\n        print(\"postRequest called with arguments: \" + str(kwargs))  \n\n    def login_and_get_request_and_post_request(self, username, password, argument, **kwargs):\n        self.login(username, password)\n        self.getRequest(argument)\n        self.postRequest(**kwargs)\n```\n\n### test in CLI\nUse CLI syntax to run your functions. \n```bash\npython3 -m yourmodule login_and_get_request_and_post_request --username myusername --password mypassword --argument [1, 2] --arg1 value1 --arg2 value2\n```\n\n### test in Python \nUse argparse-like syntax in Python for testing purposes.\nNote that Clientwrapper takes strings, ints, lists, tuples, and dictionaries as arguments but containers must be passed as strings.\n```python\nimpl = Impl()\nimpl.run([\n    'login_and_get_request_and_post_request --username myusername --password mypassword --argument \"[1, 2]\" --arg1 value1 --arg2 value2'.split()\n])\n\u003e\u003e\u003e login called with username: myusername and password: mypassword\n\u003e\u003e\u003e getRequest called with argument: [1, 2]\n\u003e\u003e\u003e postRequest called with arguments: {'arg1': 'value1', 'arg2': 'value2'}\n```\n\n### test in CMD prompt as CLI\nYour module will require a __main__.py in order to run as a CLI; here is a simple example.\n```python\nfrom src.etc.package import Impl\n\ndef main():\n    impl = Impl()\n    impl.run()\n\nif __name__ == '__main__':\n    main()\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febay%2Fclientwrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Febay%2Fclientwrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febay%2Fclientwrapper/lists"}