]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Add API sketch
authorTom Christie <tom@tomchristie.com>
Fri, 26 Apr 2019 16:08:38 +0000 (17:08 +0100)
committerTom Christie <tom@tomchristie.com>
Fri, 26 Apr 2019 16:08:38 +0000 (17:08 +0100)
API.md [new file with mode: 0644]

diff --git a/API.md b/API.md
new file mode 100644 (file)
index 0000000..56f34fe
--- /dev/null
+++ b/API.md
@@ -0,0 +1,90 @@
+Client(...)
+
+    .request(method, url, ...)
+
+    .get(url, ...)
+    .options(url, ...)
+    .head(url, ...)
+    .post(url, ...)
+    .put(url, ...)
+    .patch(url, ...)
+    .delete(url, ...)
+
+    .prepare_request(request)
+    .send(request, ...)
+    .close()
+
+
+Adapter()
+
+    .prepare_request(request)
+    .send(request)
+    .close()
+
+
++ EnvironmentAdapter
++ RedirectAdapter
++ CookieAdapter
++ AuthAdapter
++ ConnectionPool
+  + HTTPConnection
+    + HTTP11Connection
+    + HTTP2Connection
+
+
+
+Response(...)
+    .status_code    - int
+    .reason_phrase  - str
+    .protocol       - "HTTP/2" or "HTTP/1.1"
+    .url            - URL
+    .headers        - Headers
+
+    .content        - bytes
+    .text           - str
+    .encoding       - str
+    .json()         - Any
+
+    .read()         - bytes
+    .stream()       - bytes iterator
+    .raw()          - bytes iterator
+    .close()        - None
+
+    .is_redirect    - bool
+    .request        - Request
+    .cookies        - Cookies
+    .history        - List[Response]
+
+    .raise_for_status()
+    .next()
+
+
+Request(...)
+    .method
+    .url
+    .headers
+
+    ...
+
+
+Headers
+
+URL
+
+Origin
+
+Cookies
+
+
+# Sync
+
+SyncClient
+SyncResponse
+SyncRequest
+SyncAdapter
+
+
+
+SSE
+HTTP/2 server push support
+Concurrency