From: Tom Christie Date: Fri, 26 Apr 2019 16:08:38 +0000 (+0100) Subject: Add API sketch X-Git-Tag: 0.3.0~66^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe43c08adccfe309135aaf6fdbce82db9587d5c2;p=thirdparty%2Fhttpx.git Add API sketch --- 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