Skip to content

Commit 5c09119

Browse files
committed
consistent headings
1 parent 251e64b commit 5c09119

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

README.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
- [Quick Start](#quick-start)
55
- [Installation](#installation)
66
- [Structure and Functionality](#structure-and-functionality)
7-
- [`HttpClient`](#httpclient)
7+
- [HttpClient](#httpclient)
88
- [Initialization](#initialization)
9-
- [Default arguments](#default-arguments)
10-
- [Basic authentication](#basic-authentication)
11-
- [Simple POST request](#simple-post-request)
12-
- [Working with URL paths](#working-with-url-paths)
13-
- [Raw request Example](#raw-request-example)
14-
- [Building HTTP client based on HTTPClient Example](#building-http-client-based-on-httpclient-example)
15-
- [Async Usage](#async-usage)
16-
- [Building HTTP client based on AsyncHttpClient Example](#building-http-client-based-on-asynchttpclient-example)
9+
- [Default Arguments](#default-arguments)
10+
- [Basic Authentication](#basic-authentication)
11+
- [Simple POST Request](#simple-post-request)
12+
- [Working with URL Paths](#working-with-url-paths)
13+
- [Raw Request Example](#raw-request-example)
14+
- [Example Client Based on HTTPClient](#example-client-based-on-httpclient)
15+
- [AsyncHttpClient](#asynchttpclient)
16+
- [Example Client Based on AsyncHttpClient](#example-client-based-on-asynchttpclient)
1717

1818
# Python HTTP Client
1919

@@ -49,7 +49,7 @@ pip install keboola.http-client
4949
The package contains a single core module:
5050
- `keboola.http_client` - Contains the `HttpClient` class for easy manipulation with APIs and external services
5151

52-
### `HttpClient`
52+
### HttpClient
5353

5454
The core class that serves as a tool to communicate with external services. The class is a wrapper around the `requests` library with implemented retry mechanism, and automatic error handling in case of HTTP error returned.
5555

@@ -76,7 +76,7 @@ BASE_URL = "https://connection.keboola.com/v2/storage/"
7676
cl = HttpClient(BASE_URL)
7777
```
7878

79-
#### Default arguments
79+
#### Default Arguments
8080

8181
For `HttpClient`, it is possible to define default arguments, which will be sent with every request. It's possible to define `default_http_header`, `auth_header` and `default_params` - a default header, a default authentication header and default parameters, respectively.
8282

@@ -96,7 +96,7 @@ cl = HttpClient(
9696
)
9797
```
9898

99-
#### Basic authentication
99+
#### Basic Authentication
100100

101101
By specifying the `auth` argument, the `HttpClient` will utilize the basic authentication.
102102

@@ -110,7 +110,7 @@ PASSWORD = "@bcd1234"
110110
cl = HttpClient(BASE_URL, auth=(USERNAME, PASSWORD))
111111
```
112112

113-
#### Simple POST request
113+
#### Simple POST Request
114114

115115
Making a simple POST request using `post_raw()` method.
116116

@@ -143,7 +143,7 @@ header = {"content-type": "application/json"}
143143
response = cl.post(data=data, headers=header)
144144
```
145145

146-
#### Working with URL paths
146+
#### Working with URL Paths
147147

148148
Each of the methods takes an optional positional argument `endpoint_path`. If specified, the value of the `endpoint_path` will be appended to the URL specified in the `base_url` parameter, when initializing the class. When appending the `endpoint_path`, the [`urllib.parse.urljoin()`](https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urljoin) function is used.
149149

@@ -173,7 +173,7 @@ header = {"token": "token_value"}
173173
cl.post_raw("https://anothersite.com/v2", headers=header, is_absolute_path=True)
174174
```
175175

176-
#### Raw request Example
176+
#### Raw Request Example
177177

178178
A simple request made with default authentication header and parameters.
179179

@@ -193,7 +193,7 @@ if response.ok is True:
193193
print(response.json())
194194
```
195195

196-
#### Building HTTP client based on HTTPClient Example
196+
#### Example Client Based on HTTPClient
197197

198198
This example demonstrates the default use of the HTTPClient as a base for REST API clients.
199199

@@ -225,7 +225,7 @@ cl = KBCStorageClient("my_token")
225225
print(cl.get_files())
226226
```
227227

228-
## Async Usage
228+
## AsyncHttpClient
229229

230230
The package also provides an asynchronous version of the HTTP client called AsyncHttpClient.
231231
It allows you to make asynchronous requests using async/await syntax. To use the AsyncHttpClient, import it from keboola.http_client_async:
@@ -261,7 +261,8 @@ asyncio.run(main())
261261
The AsyncHttpClient provides initialization and request methods similar to the HttpClient.
262262
The request methods return awaitable coroutines that can be awaited in an asynchronous context.
263263

264-
#### Building HTTP client based on AsyncHttpClient Example
264+
#### Example Client Based on AsyncHttpClient
265+
265266
This example demonstrates the default use of the AsyncHttpClient as a base for REST API clients.
266267

267268
```py

0 commit comments

Comments
 (0)