A Flask extension to obfuscate HTML responses.
Project description
Flask-Obfuscate
Flask-Obfuscate is a Flask extension that obfuscates HTML responses to help protect your HTML content from easy inspection or copying. This extension processes all HTML responses and converts them into obfuscated JavaScript that writes the HTML content when executed in a browser.
Features
- Obfuscates HTML responses by converting them to JavaScript
- Easy to integrate into existing Flask applications
- Simple usage with minimal configuration
Installation
You can install Flask-Obfuscate via pip:
pip install Flask-Obfuscate
Usage
Basic Usage
Integrate Flask-Obfuscate into your Flask application with minimal setup:
from flask import Flask
from flask_obfuscate import Obfuscate
app = Flask(__name__)
obfuscate = Obfuscate(app)
@app.route('/')
def index():
return '<div>Hello, World!</div>'
if __name__ == '__main__':
app.run(debug=True)
Advanced Usage
You can also initialize Flask-Obfuscate later using the init_app method:
from flask import Flask
from flask_obfuscate import Obfuscate
app = Flask(__name__)
obfuscate = Obfuscate()
obfuscate.init_app(app)
@app.route('/')
def index():
return '<div>Hello, World!</div>'
if __name__ == '__main__':
app.run(debug=True)
Running Tests
To run the tests, first install the test dependencies:
pip install pytest
Then you can run the tests using pytest:
pytest tests
Contributing
Contributions are welcome! Please submit a pull request or open an issue to discuss improvements or fixes.
- Fork the repository.
- Create a new branch:
git checkout -b my-feature-branch - Make your changes and commit them:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-feature-branch - Submit a pull request.
License
This project is licensed under the MIT License.
Acknowledgments
Inspired by the need to protect HTML content in Flask applications.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask_obfuscate-0.3.tar.gz.
File metadata
- Download URL: flask_obfuscate-0.3.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d28bd96ee6bbdb652868abd53a7e329f0c21175cbd5918d122be299c1a88b618
|
|
| MD5 |
49847603fd4428ee944c1f543232c0e8
|
|
| BLAKE2b-256 |
405cd54069e2843b56eaba4a13e7492ed825e182ea77c95818a495eacc328009
|
File details
Details for the file Flask_Obfuscate-0.3-py3-none-any.whl.
File metadata
- Download URL: Flask_Obfuscate-0.3-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45826e1523abc8ff993b7150fc2cea8f4d8105610cee3aac7630d53fe6b2cf4b
|
|
| MD5 |
254d98489a11c3399117fb2d78c300f5
|
|
| BLAKE2b-256 |
230bc09dbb5f17ec65fabd6d7aa1c676a250e52352b39a0e847d6ec77dd1bb4c
|