This is a Django application that provides methods to obfuscate/deobfuscate URLs.
## Quick start
Install using pip or easy_install
$ pip install url-obfuscate
$ easy_install url-obfuscate
Add "url_obfuscate" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = (
...
'url_obfuscate',
)
## 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_obfuscate.helpers import generate_url_pattern
...
urlpatterns = patterns('views',
url(generate_url_pattern('/'), 'home', name='home'),
url(generate_url_pattern('obfuscated_link', params=['(?P<name>[^/]+)']), 'obfuscated_link', name='obfuscated_link'),
)
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_obfuscate.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 %}
...
<p><a href="{% url 'obfuscated_link' 'Laura Manzur'|obfuscate %}">Obfuscated link: {% url 'obfuscated_link' 'Laura'|obfuscate %}</a></p>
...
If you need to obfuscate any value from inside a view, use the obfuscate function, as follows:
from url_obfuscate.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-obfuscate 0.1.3
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-obfuscate-0.1.3.tar.gz | 8.1 kB | Without provenance | Details for url-obfuscate-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| url-obfuscate-0.1.3.macosx-10.10-x86_64.exe | Details for url-obfuscate-0.1.3.macosx-10.10-x86_64.exe |
Total release size: 78.2 kB
Release files / url-obfuscate-0.1.3.tar.gz
| Download URL | url-obfuscate-0.1.3.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
567b56f1b62c2149499fcc88a91067ef6ffa938ee38a9f43289d4fb7c6a70c88
|
|
BLAKE2b-256 checksum How to use checksums |
60cc4daf953d79ac0b4554a1191a9cbbd561425d887afcad92a0e14b241d41ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / url-obfuscate-0.1.3.macosx-10.10-x86_64.exe
| Download URL | url-obfuscate-0.1.3.macosx-10.10-x86_64.exe |
|---|---|
| Size | 70.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be01b3a70cec8a3d355e20fba79ab0903bdfc5ba0c05f57c1d37f3cc50dbaf68
|
|
BLAKE2b-256 checksum How to use checksums |
859999a20ccf89476c1ed9cab22498e0a4468036dc15a4bb5d98d85637d95949
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for url-obfuscate 0.1.3
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.