url-obfuscated


Nameurl-obfuscated JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/dhyanipalan/url_obfuscated
SummaryEasy and Simple method to obfuscate and deobfuscate your Django URLs.
upload_time2024-05-17 07:18:20
maintainerDhyanikumar Palan
docs_urlNone
authorDhyanikumar Palan
requires_pythonNone
licenseApache License
keywords django python urlobfuscate encrypt
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 })

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dhyanipalan/url_obfuscated",
    "name": "url-obfuscated",
    "maintainer": "Dhyanikumar Palan",
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": "dhyanipalan@gmail.com",
    "keywords": "django, Python, urlobfuscate, encrypt",
    "author": "Dhyanikumar Palan",
    "author_email": "dhyanipalan@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e0/0a/a44e7a1bfb867b2d26a60275d88c0c10df5dbde32e0266004dfed4eb0e43/url-obfuscated-1.0.0.tar.gz",
    "platform": null,
    "description": "# url_obfuscated\nEasy and Simple method to obfuscate and deobfuscate your Django URLs.\nWorks with both normal urls as well as those with params\n\n## Quick start\nInstall using pip or easy_install\n\n    $ pip install url-obfuscated\n\n    $ easy_install url-obfuscated\n\nAdd \"url_obfuscate\" to your INSTALLED_APPS setting like this:\n\n    INSTALLED_APPS = (\n        ...\n        'url_obfuscated',\n    )\n\n## Usage\nTo 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:\n\n    from url_obfuscated.helpers import generate_url_pattern\n    .....\n\n    urlpatterns = [\n        url(generate_url_pattern('/'), home, name='home'),\n        url(generate_url_pattern('obfuscated_link', params=['(?P<name>[^/]+)']), obfuscated_link, name='obfuscated_link'),\n        url(generate_url_pattern('optional_param', params=['(?:(?P<param>[^/]+)/)?']), optional_param, name='optional_param'),\n    ]\n\nFor 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.\n\n    from url_obfuscated.decorators import deobfuscate\n    ...\n\n    @deobfuscate\n    def obfuscated_link(request, name):\n        return render(request, 'obfuscate_result.html', { 'name': name })\n\nWhen declaring URLs with parameters inside templates, use the obfuscate template tag, as follows:\n\n    {% load obfuscate_tags %}\n    ...\n    <p><a href=\"{% url 'obfuscated_link' 'Dan Brown'|obfuscate %}\">Obfuscated link: {% url 'obfuscated_link' 'Dan'|obfuscate %}</a></p>\n    ...\n\nYou can also obfuscate any value from inside a view, use the obfuscate function, as follows:\n\n    from url_obfuscated.helpers import obfuscate\n    ...\n\n    def home(request):\n        links = list()\n        for i in range(10):\n            links.append(obfuscate('Name %d' % (i+1)))\n        return render(request, 'index.html', { 'links': links })\n",
    "bugtrack_url": null,
    "license": "Apache License",
    "summary": "Easy and Simple method to obfuscate and deobfuscate your Django URLs.",
    "version": "1.0.0",
    "project_urls": {
        "Download": "https://github.com/dhyanipalan/url_obfuscated",
        "Homepage": "https://github.com/dhyanipalan/url_obfuscated"
    },
    "split_keywords": [
        "django",
        " python",
        " urlobfuscate",
        " encrypt"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "076664bff76a2323dcc6c83edb03f2e0df509757112833dab6dd9bb2e8fb7445",
                "md5": "db4afdafa360b0072e077c2363721840",
                "sha256": "62338aa1c293442ae28cdb533fd60377af8fd47cfb4b24ee61eb15bb4438e159"
            },
            "downloads": -1,
            "filename": "url_obfuscated-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "db4afdafa360b0072e077c2363721840",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11972,
            "upload_time": "2024-05-17T07:18:18",
            "upload_time_iso_8601": "2024-05-17T07:18:18.309773Z",
            "url": "https://files.pythonhosted.org/packages/07/66/64bff76a2323dcc6c83edb03f2e0df509757112833dab6dd9bb2e8fb7445/url_obfuscated-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e00aa44e7a1bfb867b2d26a60275d88c0c10df5dbde32e0266004dfed4eb0e43",
                "md5": "18e9d0a75310ddc6a4165357b23b61ab",
                "sha256": "4d1030ed767b3855d1a4c9920bf570acc15ce972ede96ecfcd7acd9b155c7c0e"
            },
            "downloads": -1,
            "filename": "url-obfuscated-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "18e9d0a75310ddc6a4165357b23b61ab",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10390,
            "upload_time": "2024-05-17T07:18:20",
            "upload_time_iso_8601": "2024-05-17T07:18:20.108326Z",
            "url": "https://files.pythonhosted.org/packages/e0/0a/a44e7a1bfb867b2d26a60275d88c0c10df5dbde32e0266004dfed4eb0e43/url-obfuscated-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-17 07:18:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dhyanipalan",
    "github_project": "url_obfuscated",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "url-obfuscated"
}
        
Elapsed time: 0.28771s