Loading

Paste #pk6vrhpz5

  1. #!/usr/bin/env python3
  2.  
  3. import json
  4. import urllib.request as urlreq
  5. import sys
  6.  
  7. SERVER="https://paste.openttdcoop.org"
  8. DEFAULT_LANG="diff"
  9.  
  10.  
  11. data = {}
  12. data["data"] = sys.stdin.read()
  13.  
  14. lang = DEFAULT_LANG
  15. if len(sys.argv) > 1:
  16.     lang = sys.argv[1]
  17.  
  18. data["language"] = lang
  19.  
  20. req = urlreq.urlopen(SERVER + "/api/json/create", json.dumps(data).encode("utf-8"))
  21.  
  22. print(req.read())

Comments