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 - see the LICENSE file for details.

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.2.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.2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file flask_obfuscate-0.2.tar.gz.

File metadata

  • Download URL: flask_obfuscate-0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 9e491b4c0103300f1c601ab2e965a5bfdb8d2d987235eba6352298f026272acb
MD5 a7e7b721b55ccb0275368fb5c2abb2aa
BLAKE2b-256 17bb27ed0ae5c771ab34464de01fbd1c504ebbf4462870aa668c29d7c93db6f0

See more details on using hashes here.

File details

Details for the file Flask_Obfuscate-0.2-py3-none-any.whl.

File metadata

  • Download URL: Flask_Obfuscate-0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 40bf29f8ae362be91638f59ad3b600aa4e560d673debdb79a75658b26f427e37
MD5 9b245d9a6f176179245a5d06a42cd1f7
BLAKE2b-256 ad4f32188cad397b1c5bd317c08f13371b3166fd5976be563c510e6ef8011d5b

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