gristlabs_grist-core/sandbox/grist/functions
Alex Hall 9fffb491f9 (core) External requests
Summary:
Adds a Python function `REQUEST` which makes an HTTP GET request. Behind the scenes it:

- Raises a special exception to stop trying to evaluate the current cell and just keep the existing value.
- Notes the request arguments which will be returned by `apply_user_actions`.
- Makes the actual request in NodeJS, which sends back the raw response data in a new action `RespondToRequests` which reevaluates the cell(s) that made the request.
- Wraps the response data in a class which mimics the `Response` class of the `requests` library.

In certain cases, this asynchronous flow doesn't work and the sandbox will instead synchronously call an exported JS method:

- When reevaluating a single cell to get a formula error, the request is made synchronously.
- When a formula makes multiple requests, the earlier responses are retrieved synchronously from files which store responses as long as needed to complete evaluating formulas. See https://grist.slack.com/archives/CL1LQ8AT0/p1653399747810139

Test Plan: Added Python and nbrowser tests.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Subscribers: paulfitz, dsagal

Differential Revision: https://phab.getgrist.com/D3429
2022-06-17 21:53:20 +02:00
..
__init__.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
date.py (core) Update the current time in formulas automatically every hour 2022-04-28 21:07:40 +02:00
info.py (core) External requests 2022-06-17 21:53:20 +02:00
logical.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
lookup.py (core) Add a row to summary tables grouped by list column(s) corresponding to empty lists 2022-06-09 23:38:14 +02:00
math.py Tweaks to documentation comments for user-facing Grist functions (#126) 2022-02-13 00:45:24 -05:00
schedule.py (core) New type conversion in the backend 2022-02-04 20:28:13 +02:00
stats.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
test_schedule.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
text.py Tweaks to documentation comments for user-facing Grist functions (#126) 2022-02-13 00:45:24 -05:00
unimplemented.py (core) Improve suggestions for formula autocomplete 2020-09-12 00:21:29 -04:00