Which one is the Python module to obfuscate javascript?



You can use the jsmin module to minimize/obfuscate javascript code using Python. Install jsmin using:

$ pip install jsmin

To use jsmin in your python project to minimize a js file, say hello.js, you can use it as follows:

>>> from jsmin import jsmin
>>> with open('hello.js') as js_file:
...     minified = jsmin(js_file.read())
>>> print minified

You'll get the minified JS code printed to your shell. You can also use jsmin as a command line tool:

$ python -m jsmin hello.js

You can read more about jsmin on pypi docs: https://pypi.python.org/pypi/jsmin


Advertisements