{"id":15936332,"url":"https://github.com/vokimon/python-service","last_synced_at":"2026-04-02T02:53:49.686Z","repository":{"id":1686309,"uuid":"2414187","full_name":"vokimon/python-service","owner":"vokimon","description":"Simple web service to remotely call Python module functions and data so that they look a local object. No generators, minimal stubbing.","archived":false,"fork":false,"pushed_at":"2013-03-30T13:50:08.000Z","size":182,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T08:01:31.552Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vokimon.png","metadata":{"files":{"readme":"README.wiki","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-09-19T09:10:23.000Z","updated_at":"2014-08-22T19:40:50.000Z","dependencies_parsed_at":"2022-08-28T13:01:45.964Z","dependency_job_id":null,"html_url":"https://github.com/vokimon/python-service","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/vokimon%2Fpython-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vokimon%2Fpython-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vokimon%2Fpython-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vokimon%2Fpython-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vokimon","download_url":"https://codeload.github.com/vokimon/python-service/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250931021,"owners_count":21509802,"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":[],"created_at":"2024-10-07T04:21:10.461Z","updated_at":"2026-04-02T02:53:49.667Z","avatar_url":"https://github.com/vokimon.png","language":"Python","readme":"== About ==\n\npython-service is useful to call remote python code from a\na client python script in a very simple way.\n\n== License ==\n\nServer.py is licensed under GNU Affero GPL version 3 or later.\nhttp://www.gnu.org/licenses/agpl.html\nAn special service 'affero' is provided to ease compliance.\n\nThe rest of the code is GNU Lesser GPL version 3 or later.\nhttp://www.gnu.org/licenses/lgpl.html\nIn few words, you may freely use, modify and distribute this \nsoftware as long as you redistribute it and any changes\nyou did to the licenced software with the same conditions.\nUnlike the GNU GPL, the GNU Lesser GPL those conditions\ndo not apply on the code that uses the licenced code.\n\n== Dependencies ==\n\n* Client: urllib2, urllib, urlparse, httplib, mimetypes\n* Server: webob, decorator\n* Tests: wsgi_intercept, unittest, urllib2, urllib, urlparse, httplib, mimetypes\n\n== Installation ==\n\nNo installation procedure is provided yet.\nJust copy the needed scripts side to your own files.\n* With your client: ServiceStub.py, HttpFormPost.py\n* With your server: Service.py\n\n== How to setup the server ==\n\n* Setup a module (ie. MyModule.py) with functions and variables\n\n version = \"3.2\"\n def myFunction(param) :\n  \treturn \"result: %s\"%param\n\n* Create a Service object passing the module name as parameter.\n\n application = Service.Reload(Service.Service(\"MyModule\"))\n\n* Pass the Service as the application object of a wgsi server.\n** With mod_wsgi (apache), just name it 'application'\n** You can use other dummy servers to test:\n\n from wsgiref.simple_server import make_server\n httpd = make_server(\n \t'localhost', # Host name.\n \t8051, # port\n \tapplication, # application object\n \t)\n httpd.serve_forever()\n\n* Check that it works by opening in a web server\n \thttp://localhost:8051/MyModule/myFunction?param=value\n\n== How to setup the client ==\n\n* Create a subclass of ServiceStub representing the service\n* Implement methods like the ones in MyModule by calling\n: remoteCall, ie, for \n\n \tclass MyModule(ServiceStub.ServiceStub) :\n \n \t\tdef myFunction(self, param) :\n \t\t\treturn self.remoteCall( \"myFunction\", param=param)\n\n* Instantiate the stub in your client code and use it\n\n \tservice = MyModule(\"https://mydomain.com:8051/MyModule\")\n \tservice.myFunction(3)\n\n== Goodies ==\n\n=== Default parameters ===\n\nAny parameter can be set optional by setting a default in \nthe server.\nYou can accept any parameter by adding a **kwd parameter.\n\n=== Accessing the request object ===\n\nIf you want to access the request, just add a first parameter\nnamed 'request' to your server function. It is a webob.Request\nobject.\n\n=== Sending files to the server ===\n\nIf you pass a file object to the stub, the file content will\nbe passed as attached content and the server receives it as\ncgi.FieldStorage object.\n\n=== Changing the content-type ===\n\nBy default, the content-type is 'text/plain', if you\nwant to change it you can set a content_type property\non the server function.\n\n def myFunction(param) :\n \treturn \"result: %s\"%param\n myFunction.content_type = 'text/html'\n\n=== Forcing HTTP errors ===\n\nJust raise any subclass of Service.HttpError in Service.\nNot all errors are defined, you can just subclass it yourself.\n\n== TO-DO's ==\n\n* Add unit tests for the ServiceStub\n* Adding decorators\n* Addding easy to construct response objects\n* Signing client message\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvokimon%2Fpython-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvokimon%2Fpython-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvokimon%2Fpython-service/lists"}