@@ -33,7 +33,7 @@ The best practice is to use a `Client` as a context manager. This ensures connec
3333
3434``` python
3535with tls_requests.Client() as client:
36- response = client.get(" https://example.com " )
36+ response = client.get(" https://httpbin.org/get " )
3737 print (response) # <Response [200 OK]>
3838```
3939
@@ -44,7 +44,7 @@ If not using a context manager, ensure to close the client explicitly:
4444``` python
4545client = tls_requests.Client()
4646try :
47- response = client.get(" https://example.com " )
47+ response = client.get(" https://httpbin.org/get " )
4848 print (response) # <Response [200 OK]>
4949finally :
5050 client.close()
@@ -59,7 +59,7 @@ A `Client` can send requests using methods like `.get()`, `.post()`, etc.:
5959
6060``` python
6161with tls_requests.Client() as client:
62- response = client.get(" https://example.com " )
62+ response = client.get(" https://httpbin.org/get " )
6363 print (response) # <Response [200 OK]>
6464```
6565
@@ -70,7 +70,7 @@ To include custom headers in a request:
7070``` python
7171headers = {' X-Custom' : ' value' }
7272with tls_requests.Client() as client:
73- response = client.get(" https://example.com " , headers = headers)
73+ response = client.get(" https://httpbin.org/get " , headers = headers)
7474 print (response.request.headers[' X-Custom' ]) # 'value'
7575```
7676
@@ -101,7 +101,7 @@ When client-level and request-level options overlap:
101101client_headers = {' X-Auth' : ' client' }
102102request_headers = {' X-Custom' : ' request' }
103103with tls_requests.Client(headers = client_headers) as client:
104- response = client.get(" https://example.com " , headers = request_headers)
104+ response = client.get(" https://httpbin.org/get " , headers = request_headers)
105105 print (response.request.headers[' X-Auth' ]) # 'client'
106106 print (response.request.headers[' X-Custom' ]) # 'request'
107107```
@@ -110,7 +110,7 @@ with tls_requests.Client(headers=client_headers) as client:
110110
111111``` python
112112with tls_requests.Client(auth = (' user' , ' pass' )) as client:
113- response = client.get(" https://example.com " , auth = (' admin' , ' adminpass' ))
113+ response = client.get(" https://httpbin.org/get " , auth = (' admin' , ' adminpass' ))
114114 print (response.request.headers[' Authorization' ]) # Encoded 'admin:adminpass'
115115
116116```
@@ -123,7 +123,7 @@ Advanced Request Handling
123123For more control, explicitly build and send ` Request ` instances:
124124
125125``` python
126- request = tls_requests.Request(" GET" , " https://example.com " )
126+ request = tls_requests.Request(" GET" , " https://httpbin.org/get " )
127127with tls_requests.Client() as client:
128128 response = client.send(request)
129129 print (response) # <Response [200 OK]>
@@ -133,7 +133,7 @@ To combine client- and request-level configurations:
133133
134134``` python
135135with tls_requests.Client(headers = {" X-Client-ID" : " ABC123" }) as client:
136- request = client.build_request(" GET" , " https://api.example.com " )
136+ request = client.build_request(" GET" , " https://httpbin.org/json " )
137137 del request.headers[" X-Client-ID" ] # Modify as needed
138138 response = client.send(request)
139139 print (response)
0 commit comments