Grote push
This commit is contained in:
parent
2baf09ff6e
commit
4bcf82fa3e
4 changed files with 269 additions and 6 deletions
20
cgi-bin/init.py
Normal file
20
cgi-bin/init.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
Dit script wordt gebruikt om de methodes in de scraper aan te roepen via JavaScript. Zo kan dit toch nog redelijk
|
||||
onafhankelijk gebeuren en kan er gemakkelijker ge-debugged worden.
|
||||
De bestandsextensie werd aangepast om te kunnen debuggen op zowel Windows als Linux.
|
||||
"""
|
||||
|
||||
import cgi
|
||||
import json
|
||||
|
||||
from scraper import run, converteer
|
||||
|
||||
parameters = cgi.FieldStorage()
|
||||
data = json.loads(parameters.getvalue('data'))
|
||||
antwoord = run(data['taal'], converteer(data['start']), converteer(data['einde']))
|
||||
|
||||
print("Content-Type: application/json")
|
||||
print() # Lege lijn na headers
|
||||
print(json.dumps(antwoord))
|
Reference in a new issue