Keeping default config from help document we have
url:
drivehandler:
pattern: /$YAMLURL/drive
handler: DriveHandler
kwargs:
path: $YAMLURL/drive
modify: mymodule.modify(handler)
mymodule.py is created as:
def modify():
if handler.request.method.upper() == "POST":
import pandas as pd
data = []
for d in pd.DataFrame(handler.files).itertuples():
print("preprocesed data", d)
And gramex server is ran in the default port,
POST works great and on the browser console we get the output of the print statement.
However, when we try to GET localhost:9988/drive; Although the drive/.meta.db is populated, the result is always blank.
So wondering if I modify the POST request, Do I need to create a custom modification to GET as well?
For a GET method, this function returns
None. Instead, you could use:You would also need to modify
gramex.yamlto reflect thedataargument: