client.py 426 B

1234567891011121314151617181920212223
  1. import requests
  2. import json
  3. def main():
  4. url = "http://localhost:8000/"
  5. # Example echo method
  6. payload = {
  7. "method": "say_hello",
  8. "params": ["echome!"],
  9. "jsonrpc": "2.0",
  10. "id": 0,
  11. }
  12. response = requests.post(url, json=payload).json()
  13. print(response)
  14. assert response["result"] == "Hello World!"
  15. assert response["jsonrpc"]
  16. if __name__ == "__main__":
  17. main()