Python HTTP for Humans as cross docs data exchange

There are some notes on installing extra python packages in self-hosted Grist here:

There is actually an undocumented, disabled REQUEST() function that works similarly to requests:

You can use this method if you set GRIST_EXPERIMENTAL_PLUGINS=1 in Grist’s environment. As far as I remember, the syntax was:

response = REQUEST("...url...")
# should now have response.status_code, response.text, response.encoding, response.json()
response = REQUEST("...url...", params=dict(bar=123))  # to add query parameters conveniently

The function is disabled for a reason though, it is quite easy to make a mess using it, since cells can end up getting reevaluated for various reasons, which (when you use REQUEST) means requests get re-sent - maybe lots of them in a big doc. In trigger formulas, it could be useful. We didn’t figure out a way to communicate its limits well, and feared a big support load if we released it, so it got shelved. Apologies in advance, but I won’t be able to provide support if you use this function.

3 Likes