This repository contains a Flask-based web API for minifying Python code using the python_minifier library. The API allows users to submit Python code snippets and receive the minified version in response. Additionally, it supports CORS to enable cross-origin requests from specified origins.
To set up the Python Minifier Web API, follow these steps:
- Clone this repository to your local machine
https://github.com/glad432/python-minifier-flask.git
- Navigate into the cloned repository directory
cd python-minifier-flask
- Install the required dependencies listed in
requirements.txt
using pip:pip install -r requirements.txt
- Run the Flask application:
python app.py
- The application should now be running locally.
POST /
: Accepts a Python code snippet via a form submission and returns the minified version of the code.POST /minify
: Alternative endpoint for minification, accepting Python code snippet via form submission.GET /
: Renders an HTML page.
Cross-Origin Resource Sharing (CORS) is configured to allow requests from the following origins:
For example:
- Flask: A lightweight WSGI web application framework for Python.
- Flask-CORS: A Flask extension for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible.
- Python_minifier: Minifies Python source code, reducing it to its smallest form.
Contributions to this project are welcome. If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.