url_obfuscated
Easy and Simple method to obfuscate and deobfuscate your Django URLs. Works with both normal urls as well as those with params
Quick start
Install using pip or easy_install
$ pip install url-obfuscated
$ easy_install url-obfuscated
Add "url_obfuscate" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = (
...
'url_obfuscated',
)
Usage
To obfuscate Django's URLs, modify the URL declaration in the urls.py file by replacing the regex definition with the funcion generate_url_pattern, as follows:
from url_obfuscated.helpers import generate_url_pattern
.....
urlpatterns = [
url(generate_url_pattern('/'), home, name='home'),
url(generate_url_pattern('obfuscated_link', params=['(?P<name>[^/]+)']), obfuscated_link, name='obfuscated_link'),
url(generate_url_pattern('optional_param', params=['(?:(?P<param>[^/]+)/)?']), optional_param, name='optional_param'),
]
For the home URL, use / path. To include params in the URL, declare them in the desired order inside the params attribute. When obfuscating a URL with parameters, it is necessary to use the deobfuscate decorator to recover the original value of the parameter.
from url_obfuscated.decorators import deobfuscate
...
@deobfuscate
def obfuscated_link(request, name):
return render(request, 'obfuscate_result.html', { 'name': name })
When declaring URLs with parameters inside templates, use the obfuscate template tag, as follows:
{% load obfuscate_tags %}
...
<p><a href="{% url 'obfuscated_link' 'Dan Brown'|obfuscate %}">Obfuscated link: {% url 'obfuscated_link' 'Dan'|obfuscate %}</a></p>
...
You can also obfuscate any value from inside a view, use the obfuscate function, as follows:
from url_obfuscated.helpers import obfuscate
...
def home(request):
links = list()
for i in range(10):
links.append(obfuscate('Name %d' % (i+1)))
return render(request, 'index.html', { 'links': links })
Metadata
Release files for url-obfuscated 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| url-obfuscated-1.0.0.tar.gz | 10.4 kB | Without provenance | Details for url-obfuscated-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| url_obfuscated-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for url_obfuscated-1.0.0-py3-none-any.whl |
Total release size: 22.4 kB
Release files / url-obfuscated-1.0.0.tar.gz
| Download URL | url-obfuscated-1.0.0.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d1030ed767b3855d1a4c9920bf570acc15ce972ede96ecfcd7acd9b155c7c0e
|
|
BLAKE2b-256 checksum How to use checksums |
e00aa44e7a1bfb867b2d26a60275d88c0c10df5dbde32e0266004dfed4eb0e43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.6
|
Release files / url_obfuscated-1.0.0-py3-none-any.whl
| Download URL | url_obfuscated-1.0.0-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
62338aa1c293442ae28cdb533fd60377af8fd47cfb4b24ee61eb15bb4438e159
|
|
BLAKE2b-256 checksum How to use checksums |
076664bff76a2323dcc6c83edb03f2e0df509757112833dab6dd9bb2e8fb7445
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.6
|
Security for url-obfuscated 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.