1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Extension now gives feedback about incorrect configuration

This commit is contained in:
Krateng
2018-12-14 19:52:31 +01:00
parent 5cedde41a1
commit 95e80833cc
4 changed files with 77 additions and 16 deletions

View File

@@ -31,11 +31,16 @@ def database_get(pth):
keystring = "?"
for k in keys:
keystring += urllib.parse.quote(k) + "=" + urllib.parse.quote(keys[k]) + "&"
contents = urllib.request.urlopen("http://localhost:" + str(DATABASE_PORT) + "/" + pth + keystring).read()
response.content_type = "application/json"
response.set_header("Access-Control-Allow-Origin","*")
#print("Returning " + "http://localhost:" + str(DATABASE_PORT) + "/" + pth)
return contents
try:
proxyresponse = urllib.request.urlopen("http://localhost:" + str(DATABASE_PORT) + "/" + pth + keystring)
contents = proxyresponse.read()
response.status = proxyresponse.getcode()
response.content_type = "application/json"
return contents
except HTTPError as e:
response.status = e.code
return
@post("/db/<pth:path>")
def database_post(pth):