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

Can now actually scrobble Dal★Shabet

This commit is contained in:
Krateng 2018-11-28 12:16:13 +01:00
parent 1353e55446
commit bb754c7911

View File

@ -1,4 +1,4 @@
from bottle import route, run, template, static_file, request, response from bottle import route, run, template, static_file, request, response, FormsDict
from importlib.machinery import SourceFileLoader from importlib.machinery import SourceFileLoader
import _thread import _thread
import waitress import waitress
@ -23,10 +23,13 @@ def mainpage():
@route("/db/<pth:path>") @route("/db/<pth:path>")
def database(pth): def database(pth):
keys = request.query keys = FormsDict.decode(request.query) # The Dal★Shabet handler
for k in keys:
print(keys[k])
keystring = "?" keystring = "?"
for k in keys: for k in keys:
keystring += urllib.parse.quote(k) + "=" + urllib.parse.quote(keys[k]) + "&" keystring += urllib.parse.quote(k) + "=" + urllib.parse.quote(keys[k]) + "&"
print(keystring)
contents = urllib.request.urlopen("http://localhost:" + str(DATABASE_PORT) + "/" + pth + keystring).read() contents = urllib.request.urlopen("http://localhost:" + str(DATABASE_PORT) + "/" + pth + keystring).read()
response.content_type = "application/json" response.content_type = "application/json"
response.set_header("Access-Control-Allow-Origin","*") response.set_header("Access-Control-Allow-Origin","*")