# Python packages [My original research for gidgethub](https://docs.google.com/spreadsheets/d/1HKHvyeEnB_y4rvLEOraE0JNCcpkVCTJ_jVdKs8KFXYw/edit#gid=1754323713) # [In-browser `fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) ## Request - URL/resource (can be via a [Request object](https://developer.mozilla.org/en-US/docs/Web/API/Request)) - method (e.g., `GET`) - body - headers (dict or effectively a [list of two-item tuples](https://developer.mozilla.org/en-US/docs/Web/API/Headers)) - follow (default is to follow) - `signal` lets you communicate with the request, including setting a timeout - [`AbortSignal.timeout()`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static) sets the **total** amount of time a call is allowed to take before being aborted - Seems to essentially set a timer and if the timer triggers and the request is live then the abort signal is sent ## Response - body - headers (as a [`Headers` object](https://developer.mozilla.org/en-US/docs/Web/API/Headers), which is effectively a tuple of two-item tuples) - status - Final URL # [WASI-http](https://github.com/WebAssembly/wasi-http) Seems to be low-level, e.g., no handling of redirects on your behalf. ## [Request](https://github.com/WebAssembly/wasi-http/blob/473c9019fea75fc7f255cda5471c747ff1652db4/wit/types.wit#L148-L219) - URL - `path-with-query` - `scheme` - `authority` - method (e.g., `GET`) - headers (tuple of two-item tuples) - Body - Resource with `write()` and `finish()` - Timeout - Connection - First byte - Between bytes ## [Response](https://github.com/WebAssembly/wasi-http/blob/473c9019fea75fc7f255cda5471c747ff1652db4/wit/types.wit#L280-L292) - Status code - Headers - Body - Resource with a stream and `finish()` # [WinHTTP](https://learn.microsoft.com/en-us/windows/win32/winhttp/winhttp-sessions-overview#using-the-winhttp-api-to-access-the-web) ## Request - [User agent](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpopen) - [Proxy](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpopen) - [Server](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpconnect) - Name - Port (including automatic) - [Headers](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpaddrequestheaders) - [Verb](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpopenrequest) - [Path](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpopenrequest) - [Referrer](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpopenrequest) - [`Accept` types](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpopenrequest) - [Body](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpsendrequest) - [Timeout](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpsettimeouts) - Name resolution - Connect - Send - Receive ## Response - [Headers](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpqueryheaders) - [Body](https://learn.microsoft.com/en-us/windows/win32/winhttp/winhttp-sessions-overview#downloading-resources-from-the-web) # macOS ## [Request](https://developer.apple.com/documentation/foundation/urlrequest) - Timeout - URL - Cache policy - Verb/method - Body - Headers - Handle cookies - Use cellular radio - Allow in Low Data Mode - Allow using an expensive network connection - Attribution ## [Response](https://developer.apple.com/documentation/foundation/httpurlresponse) - Headers - Status code - Content length - MIME type - Text encoding - URL # [libcurl](https://curl.se/libcurl/) The [easy API](https://curl.se/libcurl/c/libcurl-easy.html) seems to let you do everything any of the other APIs do (the "easy" seems to refer to being synchronous).