filter-certwarning


Namefilter-certwarning JSON
Version 1.0.1 PyPI version JSON
download
home_page
SummaryDecorators for filtering InsecureRequestWarnings in requests and urllib3 apps
upload_time2023-10-11 22:21:08
maintainer
docs_urlNone
author
requires_python>=3.5
licenseBSD-2-Clause
keywords certwarning urllib3 certificate warnings
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            filter-certwarning
==================

Decorators for filtering InsecureRequestWarnings in `requests` and other `urllib3`-based Python 3 modules

**NOTE:** tested only for Python3.

When developing applications/modules using the ``requests`` module (or using ``urllib3`` directly), it is
sometimes useful to disable certificate validation, or to permit consumers/users to do so. However, doing
so makes *each request* issue an InsecureRequestWarning, which is a lot of noise.

**filter-certwarning** provides two decorators to make this behavior more reasonable.

- ``@filter_certwarning.warnonce`` causes the warning to be issued only warnonce, the first time the decorated
  function is called

- ``@filter_certwarning.silent`` is an alias for ``@filter_certwarning('ignore')``, and causes the warning to be
  entirely suppressed for that function call

Examples:
    A requests-based app with verification off that issues the warning only warnonce::

        import requests
        import filter_certwarning

        ...

        @filter_certwarning.warnonce
        sub get_data():
            # the next line will fire an InsecureRequestWarning the first time this
            # function is called, but subsequent calls to this function will be silent
            resp = requests.get('https://localhost/status', verify=False)

    The following supresses the warning entirely. **This is not recommended unless you've given a lot of thought
    to the security implications and trade-offs.**::

        import requests
        import filter_certwarning

        ...

        @filter_certwarning.silent
        sub get_data():
            # the next line will fire an InsecureRequestWarning the first time this
            # function is called, but subsequent calls to this function will be silent
            resp = requests.get('https://localhost/status', verify=False)


Installing
----------

To install::

    pip install filter-certwarning


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "filter-certwarning",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "certwarning,urllib3,certificate,warnings",
    "author": "",
    "author_email": "Darren P Meyer <darren+filtercertwarning@darrenpmeyer.com>",
    "download_url": "https://files.pythonhosted.org/packages/9f/0f/26881f28c8d65ab1b5ccccdc447b2e6bd2713e722a9b344db41bc0a66e32/filter-certwarning-1.0.1.tar.gz",
    "platform": null,
    "description": "filter-certwarning\n==================\n\nDecorators for filtering InsecureRequestWarnings in `requests` and other `urllib3`-based Python 3 modules\n\n**NOTE:** tested only for Python3.\n\nWhen developing applications/modules using the ``requests`` module (or using ``urllib3`` directly), it is\nsometimes useful to disable certificate validation, or to permit consumers/users to do so. However, doing\nso makes *each request* issue an InsecureRequestWarning, which is a lot of noise.\n\n**filter-certwarning** provides two decorators to make this behavior more reasonable.\n\n- ``@filter_certwarning.warnonce`` causes the warning to be issued only warnonce, the first time the decorated\n  function is called\n\n- ``@filter_certwarning.silent`` is an alias for ``@filter_certwarning('ignore')``, and causes the warning to be\n  entirely suppressed for that function call\n\nExamples:\n    A requests-based app with verification off that issues the warning only warnonce::\n\n        import requests\n        import filter_certwarning\n\n        ...\n\n        @filter_certwarning.warnonce\n        sub get_data():\n            # the next line will fire an InsecureRequestWarning the first time this\n            # function is called, but subsequent calls to this function will be silent\n            resp = requests.get('https://localhost/status', verify=False)\n\n    The following supresses the warning entirely. **This is not recommended unless you've given a lot of thought\n    to the security implications and trade-offs.**::\n\n        import requests\n        import filter_certwarning\n\n        ...\n\n        @filter_certwarning.silent\n        sub get_data():\n            # the next line will fire an InsecureRequestWarning the first time this\n            # function is called, but subsequent calls to this function will be silent\n            resp = requests.get('https://localhost/status', verify=False)\n\n\nInstalling\n----------\n\nTo install::\n\n    pip install filter-certwarning\n\n",
    "bugtrack_url": null,
    "license": "BSD-2-Clause",
    "summary": "Decorators for filtering InsecureRequestWarnings in requests and urllib3 apps",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/darrenpmeyer/filter-certwarning",
        "Repository": "https://github.com/darrenpmeyer/filter-certwarning.git"
    },
    "split_keywords": [
        "certwarning",
        "urllib3",
        "certificate",
        "warnings"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5729da6887f0ad5151c4e0129581d40aa5898037faf674ba5bc736c813080006",
                "md5": "421c774449f85d55e210d71eb31904a0",
                "sha256": "6bc9d807e545d7c739b5dfac9b8e85d6abf9fc9f87898cd9b19a395f317cf8d1"
            },
            "downloads": -1,
            "filename": "filter_certwarning-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "421c774449f85d55e210d71eb31904a0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 4343,
            "upload_time": "2023-10-11T22:21:07",
            "upload_time_iso_8601": "2023-10-11T22:21:07.110534Z",
            "url": "https://files.pythonhosted.org/packages/57/29/da6887f0ad5151c4e0129581d40aa5898037faf674ba5bc736c813080006/filter_certwarning-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9f0f26881f28c8d65ab1b5ccccdc447b2e6bd2713e722a9b344db41bc0a66e32",
                "md5": "0ccf4039a7e18781c694a03dccbf28c0",
                "sha256": "e6e6721a92fefb0391f6cdbdd50185c0e004ab9c0393e894f4a4cf031a0284f7"
            },
            "downloads": -1,
            "filename": "filter-certwarning-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0ccf4039a7e18781c694a03dccbf28c0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 5244,
            "upload_time": "2023-10-11T22:21:08",
            "upload_time_iso_8601": "2023-10-11T22:21:08.027213Z",
            "url": "https://files.pythonhosted.org/packages/9f/0f/26881f28c8d65ab1b5ccccdc447b2e6bd2713e722a9b344db41bc0a66e32/filter-certwarning-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-11 22:21:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "darrenpmeyer",
    "github_project": "filter-certwarning",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "filter-certwarning"
}
        
Elapsed time: 0.38160s