From fe43c08adccfe309135aaf6fdbce82db9587d5c2 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 26 Apr 2019 17:08:38 +0100 Subject: [PATCH] Add API sketch --- API.md | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 API.md diff --git a/API.md b/API.md new file mode 100644 index 00000000..56f34fe5 --- /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 -- 2.47.3