client.py 435 B

123456789101112
  1. import json
  2. import requests
  3. import connection
  4. host = 'http://127.0.0.1:' + str(connection.port)
  5. headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
  6. r = requests.post(host + '/register', data=json.dumps({"username": "user1", "password": "qwertz"}), headers=headers)
  7. print(r.content)
  8. r = requests.post(host + '/login', data=json.dumps({"username": "user1", "password": "qwertz"}), headers=headers)
  9. print(r.content)