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.
- Host: GitHub
- URL: https://github.com/ronknight/flask-url-cleaner
- Owner: ronknight
- Created: 2024-09-17T15:48:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-19T19:56:16.000Z (over 1 year ago)
- Last Synced: 2024-12-27T14:33:57.245Z (about 1 year ago)
- Topics: cleaner, flask, parameter, url
- Language: HTML
- Homepage: https://pinoyitsolution.com
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
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¶m2=value2"
}
```
**Response:**
```json
{
"cleaned_url": "https://example.com/page?param1=value1¶m2=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¶m2=value2"}' http://127.0.0.1:5000/clean_url
```
Expected output:
```json
{
"cleaned_url": "https://example.com/page?param1=value1¶m2=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)