An open API service indexing awesome lists of open source software.

https://github.com/ronknight/flask-url-cleaner

๐ŸงนA simple Flask API that removes the csrfToken parameter from URLs.
https://github.com/ronknight/flask-url-cleaner

cleaner flask parameter url

Last synced: 3 months ago
JSON representation

๐ŸงนA simple Flask API that removes the csrfToken parameter from URLs.

Awesome Lists containing this project

README

          

#

๐Ÿงน [Flask URL Cleaner](https://github.com/ronknight/flask-url-cleaner)

####

A simple Flask web application that removes the 'csrfToken' parameter from URLs.












Features โ€ข
Requirements โ€ข
Installation โ€ข
Project Structure โ€ข
Usage โ€ข
API Endpoint โ€ข
Example โ€ข
Web Interface

---

## ๐ŸŒŸ Features

- Removes the 'csrfToken' parameter from URLs
- Simple Flask web application with a user interface
- API endpoint for programmatic access
- Easily integrable into larger projects

## ๐Ÿ“‹ Requirements

- Python 3.x
- Flask

## ๐Ÿ› ๏ธ Installation

1. Clone the repository:
```bash
git clone https://github.com/ronknight/flask-url-cleaner.git
cd flask-url-cleaner
```

2. Install the required dependencies:
```bash
pip install flask
```

## ๐Ÿ“ Project Structure

The project has the following structure:

```
flask-url-cleaner/
โ”‚
โ”œโ”€โ”€ app.py
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ index.html
```

- `app.py`: The main Flask application file
- `README.md`: This file, containing project information and instructions
- `index.html`: The HTML template for the web interface

## ๐Ÿš€ Usage

1. Run the Flask application:
```bash
python app.py
```

2. The server will start running on `http://127.0.0.1:5000/` and will be accessible on your local network.

3. Open your web browser and navigate to `http://127.0.0.1:5000/` or use your local network IP address to access the application from other devices.

## ๐Ÿ“ก API Endpoint

### POST /clean_url

Removes the 'csrfToken' parameter from the provided URL.

**Request Body:**
```json
{
"url": "https://example.com/page?param1=value1&csrfToken=abc123&param2=value2"
}
```

**Response:**
```json
{
"cleaned_url": "https://example.com/page?param1=value1&param2=value2"
}
```

## ๐Ÿ’ก Example

Using curl to test the API:

```bash
curl -X POST -H "Content-Type: application/json" -d '{"url": "https://example.com/page?param1=value1&csrfToken=abc123&param2=value2"}' http://127.0.0.1:5000/clean_url
```

Expected output:
```json
{
"cleaned_url": "https://example.com/page?param1=value1&param2=value2"
}
```

## ๐ŸŒ Web Interface

The application includes a web interface for easy URL cleaning:

1. Open your web browser and go to `http://127.0.0.1:5000/` or use your local network IP address (e.g., `http://192.168.1.200:5000/`)
2. You'll see a form with the title "Enter a URL to Clean"
3. Enter the URL you want to clean in the provided input field
4. Click the "Clean URL" button
5. The cleaned URL will be displayed in the "Response" section below the form

The web interface is rendered using the `index.html` file located in the root directory. Flask serves this file directly from the root directory when you navigate to the root URL `/`.

---

Made with โค๏ธ by [Ronknight](https://github.com/ronknight)