Caching Proxy(https://roadmap.sh/projects/caching-server)
This is a simple asynchronous proxy built with Python and aiohttp. It sends requests to a specified server and caches and logs the responses.
- Asynchronous HTTP requests using aiohttp
- Configurable proxy URL
- Detailed logging of requests and responses
- Error handling and timeout management
- Python 3.7+
- aiohttp
- Clone this repository:
git clone https://github.com/yourusername/proxy-client.git
cd proxy-client
- Install the required packages:
pip install aiohttp
- Ensure your proxy server is running and accessible.
python proxy_server.py --port 3002 --origin https://dummyjson.com
or
python proxy_server.py --port 3002 --origin https://example.com
- Run the client script:
python proxy_client.py
-
When prompted, enter the proxy URL (e.g.,
http://localhost:3002
). -
The client will send requests to the following endpoints:
- /products
- /users
- /todos
- /carts
- /posts
- /comments
- Check the console output for detailed logs of each request and response.
You can modify the urls
list in the __main__
section of the script to change the endpoints the client requests.
If you encounter connection issues:
- Verify that your proxy server is running and accessible.
- Check for any firewall or antivirus software that might be blocking the connection.
- Ensure the proxy server is binding to the correct address (0.0.0.0 or localhost).
- Try increasing the timeout values in the
aiohttp.ClientTimeout
configuration.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.