github.com/micro/go-micro/examples@v0.0.0-20210105173217-bf4ab679e18b/proxy/python/proxy.py (about) 1 import uuid 2 import requests 3 import json 4 5 registry_uri = "http://localhost:8081/registry" 6 call_uri = "http://localhost:8081" 7 headers = {'content-type': 'application/json'} 8 9 def register(service): 10 return requests.post(registry_uri, data=json.dumps(service), headers=headers) 11 12 def deregister(service): 13 return requests.delete(registry_uri, data=json.dumps(service), headers=headers) 14 15 def rpc_call(path, request): 16 return requests.post(call_uri + path, data=json.dumps(request), headers=headers).json() 17 18 def http_call(path, request): 19 return requests.post(call_uri + path, data=request) 20