1
1

connection.py 559 B

12345678910111213141516171819202122232425
  1. import json
  2. import requests
  3. from debug import debug
  4. port = 8451
  5. if debug:
  6. host = 'http://localhost:' + str(port)
  7. else:
  8. host = 'http://koljastrohm-games.com:' + str(port)
  9. json_headers = {'Content-type': 'application/json'}
  10. def client_request(route, data):
  11. if debug:
  12. print('Sending to Server: ' + str(json.dumps(data)))
  13. r = requests.post(host + '/' + route, data=json.dumps(data),
  14. headers=json_headers)
  15. if debug:
  16. print('Request returned: ' + str(r.content))
  17. return r.json()
  18. session_id = None