Skip to main content

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.

  1. Fork the repository.
  2. Create a new branch: git checkout -b my-feature-branch
  3. Make your changes and commit them: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-feature-branch
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_obfuscate-0.3.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Flask_Obfuscate-0.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

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

Hashes for flask_obfuscate-0.3.tar.gz
Algorithm Hash digest
SHA256 d28bd96ee6bbdb652868abd53a7e329f0c21175cbd5918d122be299c1a88b618
MD5 49847603fd4428ee944c1f543232c0e8
BLAKE2b-256 405cd54069e2843b56eaba4a13e7492ed825e182ea77c95818a495eacc328009

See more details on using hashes here.

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

Hashes for Flask_Obfuscate-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 45826e1523abc8ff993b7150fc2cea8f4d8105610cee3aac7630d53fe6b2cf4b
MD5 254d98489a11c3399117fb2d78c300f5
BLAKE2b-256 230bc09dbb5f17ec65fabd6d7aa1c676a250e52352b39a0e847d6ec77dd1bb4c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page