mirror of
https://github.com/go-micro/go-micro.git
synced 2025-06-18 22:17:44 +02:00
Add examples
This commit is contained in:
README.mdLICENSEREADME.md_config.yml
examples
.github
workflows
api
booking
broker
client
command
config
event
filter
flags
form
function
gateway
getip
go.modgo.sumgraceful
greeter
README.md
api
cli
srv
web
heartbeat
helloworld
kubernetes
metadata
mocking
noproto
options
plugins
proxy
pubsub
redirect
roundrobin
secure
server
service
sharding
shutdown
stream
template
README.md
api
fnc
srv
web
tunnel
waitgroup
web
wrapper
22
examples/greeter/cli/python/rpc_client.py
Normal file
22
examples/greeter/cli/python/rpc_client.py
Normal file
@ -0,0 +1,22 @@
|
||||
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()
|
Reference in New Issue
Block a user