mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
datasette.client now applies base_url, closes #1026
This commit is contained in:
parent
7a67bc7a56
commit
84bc7244c1
5 changed files with 56 additions and 13 deletions
|
|
@ -387,6 +387,18 @@ It offers the following methods:
|
|||
``await datasette.client.request(method, path, **kwargs)`` - returns HTTPX Response
|
||||
Execute an internal request with the given HTTP method against that path.
|
||||
|
||||
These methods can be used with :ref:`internals_datasette_urls` - for example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
table_json = (
|
||||
await datasette.client.get(
|
||||
datasette.urls.table("fixtures", "facetable", format="json")
|
||||
)
|
||||
).json()
|
||||
|
||||
``datasette.client`` methods automatically take the current :ref:`config_base_url` setting into account, whether or not you use the ``datasette.urls`` family of methods to construct the path.
|
||||
|
||||
For documentation on available ``**kwargs`` options and the shape of the HTTPX Response object refer to the `HTTPX Async documentation <https://www.python-httpx.org/async/>`__.
|
||||
|
||||
.. _internals_datasette_urls:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue