prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Honor PYTHONWARNINGS for SNIMissingWarning
  .local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
    SNIMissingWarning
  .local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
    InsecurePlatformWarning
  
  I'm not here to discuss the validity of those warnings, but when I tried to get rid of them with the PYTHONWARNINGS environment variable, it only works for the InsecurePlatformWarning one. The other is always displayed whatever I put in PYTHONWARNINGS.
  
  Please advise what PYTHONWARNINGS value to use to get rid of this one, this is a documented python feature: 
  https://docs.python.org/2/library/warnings.html
  https://docs.python.org/2/using/cmdline.html?highlight=pythonwarnings#envvar-PYTHONWARNINGS
  
  Also seen the same problem here: in https://github.com/shazow/urllib3/issues/497
  
  Thanks
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `urllib3/__init__.py`
  Content:
  ```
  1 """
  2 urllib3 - Thread-safe connection pooling and re-using.
  3 """
  4 from __future__ import absolute_import
  5 import warnings
  6 
  7 from .connectionpool import (
  8     HTTPConnectionPool,
  9     HTTPSConnectionPool,
  10     connection_from_url
  11 )
  12 
  13 from . import exceptions
  14 from .filepost import encode_multipart_formdata
  15 from .poolmanager import PoolManager, ProxyManager, proxy_from_url
  16 from .response import HTTPResponse
  17 from .util.request import make_headers
  18 from .util.url import get_host
  19 from .util.timeout import Timeout
  20 from .util.retry import Retry
  21 
  22 
  23 # Set default logging handler to avoid "No handler found" warnings.
  24 import logging
  25 try:  # Python 2.7+
  26     from logging import NullHandler
  27 except ImportError:
  28     class NullHandler(logging.Handler):
  29         def emit(self, record):
  30             pass
  31 
  32 __author__ = 'Andrey Petrov (andrey.petrov@shazow.net)'
  33 __license__ = 'MIT'
  34 __version__ = 'dev'
  35 
  36 __all__ = (
  37     'HTTPConnectionPool',
  38     'HTTPSConnectionPool',
  39     'PoolManager',
  40     'ProxyManager',
  41     'HTTPResponse',
  42     'Retry',
  43     'Timeout',
  44     'add_stderr_logger',
  45     'connection_from_url',
  46     'disable_warnings',
  47     'encode_multipart_formdata',
  48     'get_host',
  49     'make_headers',
  50     'proxy_from_url',
  51 )
  52 
  53 logging.getLogger(__name__).addHandler(NullHandler())
  54 
  55 
  56 def add_stderr_logger(level=logging.DEBUG):
  57     """
  58     Helper for quickly adding a StreamHandler to the logger. Useful for
  59     debugging.
  60 
  61     Returns the handler after adding it.
  62     """
  63     # This method needs to be in this __init__.py to get the __name__ correct
  64     # even if urllib3 is vendored within another package.
  65     logger = logging.getLogger(__name__)
  66     handler = logging.StreamHandler()
  67     handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))
  68     logger.addHandler(handler)
  69     logger.setLevel(level)
  70     logger.debug('Added a stderr logging handler to logger: %s', __name__)
  71     return handler
  72 
  73 # ... Clean up.
  74 del NullHandler
  75 
  76 
  77 # SecurityWarning's always go off by default.
  78 warnings.simplefilter('always', exceptions.SecurityWarning, append=True)
  79 # SubjectAltNameWarning's should go off once per host
  80 warnings.simplefilter('default', exceptions.SubjectAltNameWarning)
  81 # InsecurePlatformWarning's don't vary between requests, so we keep it default.
  82 warnings.simplefilter('default', exceptions.InsecurePlatformWarning,
  83                       append=True)
  84 # SNIMissingWarnings should go off only once.
  85 warnings.simplefilter('default', exceptions.SNIMissingWarning)
  86 
  87 
  88 def disable_warnings(category=exceptions.HTTPWarning):
  89     """
  90     Helper for quickly disabling all urllib3 warnings.
  91     """
  92     warnings.simplefilter('ignore', category)
  93
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/urllib3/__init__.py b/urllib3/__init__.py
  --- a/urllib3/__init__.py
  +++ b/urllib3/__init__.py
  @@ -74,15 +74,18 @@
   del NullHandler
   
   
  +# All warning filters *must* be appended unless you're really certain that they
  +# shouldn't be: otherwise, it's very hard for users to use most Python
  +# mechanisms to silence them.
   # SecurityWarning's always go off by default.
   warnings.simplefilter('always', exceptions.SecurityWarning, append=True)
   # SubjectAltNameWarning's should go off once per host
  -warnings.simplefilter('default', exceptions.SubjectAltNameWarning)
  +warnings.simplefilter('default', exceptions.SubjectAltNameWarning, append=True)
   # InsecurePlatformWarning's don't vary between requests, so we keep it default.
   warnings.simplefilter('default', exceptions.InsecurePlatformWarning,
                         append=True)
   # SNIMissingWarnings should go off only once.
  -warnings.simplefilter('default', exceptions.SNIMissingWarning)
  +warnings.simplefilter('default', exceptions.SNIMissingWarning, append=True)
   
   
   def disable_warnings(category=exceptions.HTTPWarning):
  
verification_info: {"golden_diff": "diff --git a/urllib3/__init__.py b/urllib3/__init__.py\n--- a/urllib3/__init__.py\n+++ b/urllib3/__init__.py\n@@ -74,15 +74,18 @@\n del NullHandler\n \n \n+# All warning filters *must* be appended unless you're really certain that they\n+# shouldn't be: otherwise, it's very hard for users to use most Python\n+# mechanisms to silence them.\n # SecurityWarning's always go off by default.\n warnings.simplefilter('always', exceptions.SecurityWarning, append=True)\n # SubjectAltNameWarning's should go off once per host\n-warnings.simplefilter('default', exceptions.SubjectAltNameWarning)\n+warnings.simplefilter('default', exceptions.SubjectAltNameWarning, append=True)\n # InsecurePlatformWarning's don't vary between requests, so we keep it default.\n warnings.simplefilter('default', exceptions.InsecurePlatformWarning,\n                       append=True)\n # SNIMissingWarnings should go off only once.\n-warnings.simplefilter('default', exceptions.SNIMissingWarning)\n+warnings.simplefilter('default', exceptions.SNIMissingWarning, append=True)\n \n \n def disable_warnings(category=exceptions.HTTPWarning):\n", "issue": "Honor PYTHONWARNINGS for SNIMissingWarning\n.local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.\n  SNIMissingWarning\n.local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.\n  InsecurePlatformWarning\n\nI'm not here to discuss the validity of those warnings, but when I tried to get rid of them with the PYTHONWARNINGS environment variable, it only works for the InsecurePlatformWarning one. The other is always displayed whatever I put in PYTHONWARNINGS.\n\nPlease advise what PYTHONWARNINGS value to use to get rid of this one, this is a documented python feature: \nhttps://docs.python.org/2/library/warnings.html\nhttps://docs.python.org/2/using/cmdline.html?highlight=pythonwarnings#envvar-PYTHONWARNINGS\n\nAlso seen the same problem here: in https://github.com/shazow/urllib3/issues/497\n\nThanks\n\n", "before_files": [{"content": "\"\"\"\nurllib3 - Thread-safe connection pooling and re-using.\n\"\"\"\nfrom __future__ import absolute_import\nimport warnings\n\nfrom .connectionpool import (\n    HTTPConnectionPool,\n    HTTPSConnectionPool,\n    connection_from_url\n)\n\nfrom . import exceptions\nfrom .filepost import encode_multipart_formdata\nfrom .poolmanager import PoolManager, ProxyManager, proxy_from_url\nfrom .response import HTTPResponse\nfrom .util.request import make_headers\nfrom .util.url import get_host\nfrom .util.timeout import Timeout\nfrom .util.retry import Retry\n\n\n# Set default logging handler to avoid \"No handler found\" warnings.\nimport logging\ntry:  # Python 2.7+\n    from logging import NullHandler\nexcept ImportError:\n    class NullHandler(logging.Handler):\n        def emit(self, record):\n            pass\n\n__author__ = 'Andrey Petrov (andrey.petrov@shazow.net)'\n__license__ = 'MIT'\n__version__ = 'dev'\n\n__all__ = (\n    'HTTPConnectionPool',\n    'HTTPSConnectionPool',\n    'PoolManager',\n    'ProxyManager',\n    'HTTPResponse',\n    'Retry',\n    'Timeout',\n    'add_stderr_logger',\n    'connection_from_url',\n    'disable_warnings',\n    'encode_multipart_formdata',\n    'get_host',\n    'make_headers',\n    'proxy_from_url',\n)\n\nlogging.getLogger(__name__).addHandler(NullHandler())\n\n\ndef add_stderr_logger(level=logging.DEBUG):\n    \"\"\"\n    Helper for quickly adding a StreamHandler to the logger. Useful for\n    debugging.\n\n    Returns the handler after adding it.\n    \"\"\"\n    # This method needs to be in this __init__.py to get the __name__ correct\n    # even if urllib3 is vendored within another package.\n    logger = logging.getLogger(__name__)\n    handler = logging.StreamHandler()\n    handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))\n    logger.addHandler(handler)\n    logger.setLevel(level)\n    logger.debug('Added a stderr logging handler to logger: %s', __name__)\n    return handler\n\n# ... Clean up.\ndel NullHandler\n\n\n# SecurityWarning's always go off by default.\nwarnings.simplefilter('always', exceptions.SecurityWarning, append=True)\n# SubjectAltNameWarning's should go off once per host\nwarnings.simplefilter('default', exceptions.SubjectAltNameWarning)\n# InsecurePlatformWarning's don't vary between requests, so we keep it default.\nwarnings.simplefilter('default', exceptions.InsecurePlatformWarning,\n                      append=True)\n# SNIMissingWarnings should go off only once.\nwarnings.simplefilter('default', exceptions.SNIMissingWarning)\n\n\ndef disable_warnings(category=exceptions.HTTPWarning):\n    \"\"\"\n    Helper for quickly disabling all urllib3 warnings.\n    \"\"\"\n    warnings.simplefilter('ignore', category)\n", "path": "urllib3/__init__.py"}], "after_files": [{"content": "\"\"\"\nurllib3 - Thread-safe connection pooling and re-using.\n\"\"\"\nfrom __future__ import absolute_import\nimport warnings\n\nfrom .connectionpool import (\n    HTTPConnectionPool,\n    HTTPSConnectionPool,\n    connection_from_url\n)\n\nfrom . import exceptions\nfrom .filepost import encode_multipart_formdata\nfrom .poolmanager import PoolManager, ProxyManager, proxy_from_url\nfrom .response import HTTPResponse\nfrom .util.request import make_headers\nfrom .util.url import get_host\nfrom .util.timeout import Timeout\nfrom .util.retry import Retry\n\n\n# Set default logging handler to avoid \"No handler found\" warnings.\nimport logging\ntry:  # Python 2.7+\n    from logging import NullHandler\nexcept ImportError:\n    class NullHandler(logging.Handler):\n        def emit(self, record):\n            pass\n\n__author__ = 'Andrey Petrov (andrey.petrov@shazow.net)'\n__license__ = 'MIT'\n__version__ = 'dev'\n\n__all__ = (\n    'HTTPConnectionPool',\n    'HTTPSConnectionPool',\n    'PoolManager',\n    'ProxyManager',\n    'HTTPResponse',\n    'Retry',\n    'Timeout',\n    'add_stderr_logger',\n    'connection_from_url',\n    'disable_warnings',\n    'encode_multipart_formdata',\n    'get_host',\n    'make_headers',\n    'proxy_from_url',\n)\n\nlogging.getLogger(__name__).addHandler(NullHandler())\n\n\ndef add_stderr_logger(level=logging.DEBUG):\n    \"\"\"\n    Helper for quickly adding a StreamHandler to the logger. Useful for\n    debugging.\n\n    Returns the handler after adding it.\n    \"\"\"\n    # This method needs to be in this __init__.py to get the __name__ correct\n    # even if urllib3 is vendored within another package.\n    logger = logging.getLogger(__name__)\n    handler = logging.StreamHandler()\n    handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))\n    logger.addHandler(handler)\n    logger.setLevel(level)\n    logger.debug('Added a stderr logging handler to logger: %s', __name__)\n    return handler\n\n# ... Clean up.\ndel NullHandler\n\n\n# All warning filters *must* be appended unless you're really certain that they\n# shouldn't be: otherwise, it's very hard for users to use most Python\n# mechanisms to silence them.\n# SecurityWarning's always go off by default.\nwarnings.simplefilter('always', exceptions.SecurityWarning, append=True)\n# SubjectAltNameWarning's should go off once per host\nwarnings.simplefilter('default', exceptions.SubjectAltNameWarning, append=True)\n# InsecurePlatformWarning's don't vary between requests, so we keep it default.\nwarnings.simplefilter('default', exceptions.InsecurePlatformWarning,\n                      append=True)\n# SNIMissingWarnings should go off only once.\nwarnings.simplefilter('default', exceptions.SNIMissingWarning, append=True)\n\n\ndef disable_warnings(category=exceptions.HTTPWarning):\n    \"\"\"\n    Helper for quickly disabling all urllib3 warnings.\n    \"\"\"\n    warnings.simplefilter('ignore', category)\n", "path": "urllib3/__init__.py"}]}