mirror of
https://github.com/go-micro/go-micro.git
synced 2025-03-17 20:28:06 +02:00
23 lines
450 B
Python
23 lines
450 B
Python
import requests
|
|
import json
|
|
|
|
|
|
def main():
|
|
url = "http://localhost:4000"
|
|
headers = {'content-type': 'application/json'}
|
|
|
|
# Example echo method
|
|
payload = {
|
|
"method": "Say.Hello",
|
|
"params": [{"name": "John"}],
|
|
"jsonrpc": "2.0",
|
|
"id": 0,
|
|
}
|
|
response = requests.post(
|
|
url, data=json.dumps(payload), headers=headers).json()
|
|
|
|
print response["result"]
|
|
|
|
if __name__ == "__main__":
|
|
main()
|