mirror of
https://github.com/go-micro/go-micro.git
synced 2025-01-23 17:53:05 +02:00
21 lines
597 B
Python
21 lines
597 B
Python
import uuid
|
|
import requests
|
|
import json
|
|
|
|
registry_uri = "http://localhost:8081/registry"
|
|
call_uri = "http://localhost:8081"
|
|
headers = {'content-type': 'application/json'}
|
|
|
|
def register(service):
|
|
return requests.post(registry_uri, data=json.dumps(service), headers=headers)
|
|
|
|
def deregister(service):
|
|
return requests.delete(registry_uri, data=json.dumps(service), headers=headers)
|
|
|
|
def rpc_call(path, request):
|
|
return requests.post(call_uri + path, data=json.dumps(request), headers=headers).json()
|
|
|
|
def http_call(path, request):
|
|
return requests.post(call_uri + path, data=request)
|
|
|