You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
483 B
16 lines
483 B
2 years ago
|
import csv
|
||
|
import io
|
||
|
import urllib.request
|
||
|
import urllib.parse
|
||
|
|
||
|
def runsql(sql: str) -> csv.DictReader:
|
||
|
sql_escaped = urllib.parse.urlencode({'sql': sql})
|
||
|
URL = 'https://driver-observer.thi.de/retrieve_arbitrary_sql.php'
|
||
|
|
||
|
req = urllib.request.Request('{}?{}'.format(URL, sql_escaped))
|
||
|
req.add_header('Auth', 'Qnb7jfeGZM')
|
||
|
|
||
|
with urllib.request.urlopen(req) as res:
|
||
|
return csv.DictReader(io.StringIO(res.read().decode('utf-8'), newline=''))
|
||
|
|