
- Requests Tutorial
- Requests - Home
- Requests - Overview
- Requests - Environment Setup
- Requests - How Http Requests Work?
- Requests - Working with Requests
- Handling Response for HTTP Requests
- Requests - HTTP Requests Headers
- Requests - Handling GET Requests
- Handling POST, PUT, PATCH & DELETE Requests
- Requests - File Upload
- Requests - Working with Cookies
- Requests - Working with Errors
- Requests - Handling Timeouts
- Requests - Handling Redirection
- Requests - Handling History
- Requests - Handling Sessions
- Requests - SSL Certification
- Requests - Authentication
- Requests - Event Hooks
- Requests - Proxy
- Requests - Web Scraping using Requests
- Requests Useful Resources
- Requests - Quick Guide
- Requests - Useful Resources
- Requests - Discussion
Requests - Proxy
So far, we have seen clients directly connecting and talking to the server. Using proxy, the interaction happens as follows −
- The client sends a request to the proxy.
- The proxy sends the request to the server.
- The server sends back the response to the proxy.
- The proxy will send a response back to the client.
Using Http-proxy is additional security assigned to manage the data exchange between client and server. The requests libraries also have provision to handle proxy, by using the proxies param as shown below −
Example
import requests proxies = { 'http': 'http://localhost:8080' } res = requests.get('http://httpbin.org/', proxies=proxies) print(res.status_code)
The request will route to http://localhost:8080 URL.
Output
200
Advertisements