#!/usr/bin/env python3
import json
import urllib.request as urlreq
import sys
SERVER="https://paste.openttdcoop.org"
DEFAULT_LANG="diff"
data = {}
data["data"] = sys.stdin.read()
lang = DEFAULT_LANG
if len(sys.argv) > 1:
lang = sys.argv[1]
data["language"] = lang
req = urlreq.urlopen(SERVER + "/api/json/create", json.dumps(data).encode("utf-8"))
print(req.read())