Skip to content

Latest commit

 

History

History
73 lines (43 loc) · 2.06 KB

README.md

File metadata and controls

73 lines (43 loc) · 2.06 KB

HTTP Worker

CI/CD

HTTP Worker is a simple REST API built with Flask and cloudscraper that allows you to send HTTP requests to any URL.

Getting Started

Prerequisites

  • Docker

Installation

  1. Clone the repository:
git clone https://github.com/arifnd/http-worker.git
  1. Change into the project directory:
cd http-worker
  1. Build the Docker image:
docker build -t http-worker .
  1. Start the application using Docker:
docker run --rm -e SECRET_KEY=my-secret-key -e ALLOWED_IPS=127.0.0.1,192.168.1.1 -p 8080:8080 http-worker

Note: Replace my-secret-key and 127.0.0.1,192.168.1.1 with your own values for the SECRET_KEY and ALLOWED_IPS environment variables.

This command will start a new Docker container. Once the tests are complete, the container will be automatically deleted.

Usage

You can use any HTTP client to send a POST request to the /request endpoint with the url parameter set to the URL you want to request.

For example, using curl:

curl -X POST -H "X-Secret-Key: my-secret-key" http://localhost:8080/request -d "url=https://www.google.com"

You should receive a response with the HTTP status code and body of the response.

Testing

To run the unit tests, use the following command:

docker run --rm -e SECRET_KEY=my-secret-key -e ALLOWED_IPS=127.0.0.1,192.168.1.1 http-worker python -m unittest discover -s test

Note: Replace my-secret-key and 127.0.0.1,192.168.1.1 with your own values for the SECRET_KEY and ALLOWED_IPS environment variables.

This command will start a new Docker container and run the tests inside it. Once the tests are complete, the container will be automatically deleted.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.

License

This project is licensed under the MIT License. See the LICENSE file for details.