github.com/micro/go-micro/examples@v0.0.0-20210105173217-bf4ab679e18b/greeter/cli/python/sidecar_client.py (about)

     1  import requests
     2  import json
     3  
     4  
     5  def main():
     6      url = "http://localhost:8081/rpc"
     7      headers = {'content-type': 'application/json'}
     8  
     9      # Example echo method
    10      payload = {
    11  	"service": "go.micro.srv.greeter",
    12          "method": "Say.Hello",
    13          "request": {"name": "John"},
    14      }
    15      response = requests.post(
    16          url, data=json.dumps(payload), headers=headers).json()
    17  
    18      print response
    19  
    20  if __name__ == "__main__":
    21      main()