Logging Requests#

While debugging, you might want to see the API requests that are being sent for every query. To do this, just set the logging level to “DEBUG”:

1from logging import basicConfig, DEBUG
2from postgrest import SyncPostgrestClient
3
4basicConfig(level=DEBUG)
5
6client  = SyncPostgrestClient(...)
7
8client.from_("test").select("*").eq("a", "b").execute()
9client.from_("test").select("*").eq("foo", "bar").eq("baz", "spam").execute()

Output:

DEBUG:httpx._client:HTTP Request: GET https://<URL>/rest/v1/test?select=%2A&a=eq.b "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: GET https://<URL>/rest/v1/test?select=%2A&foo=eq.bar&baz=eq.spam "HTTP/1.1 200 OK"