"Fossies" - the Fresh Open Source Software Archive

Member "xhtml2pdf-0.2.5/xhtml2pdf/config/httpconfig.py" (25 Sep 2020, 1160 Bytes) of package /linux/www/xhtml2pdf-0.2.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "httpconfig.py" see the Fossies "Dox" file reference documentation.

    1 '''
    2 Created on 1 dic. 2017
    3 
    4 @author: luisza
    5 '''
    6 
    7 import ssl
    8 
    9 
   10 class HttpConfig(dict):
   11     """
   12     Configuration settings for httplib
   13     
   14     See 
   15     - python2 : https://docs.python.org/2/library/httplib.html#httplib.HTTPSConnection
   16     - python3 : https://docs.python.org/3.4/library/http.client.html#http.client.HTTPSConnection
   17     
   18     available settings 
   19     
   20     - http_key_file
   21     - http_cert_file
   22     - http_source_address
   23     - http_timeout
   24     
   25     """
   26       
   27     def save_keys(self, name, value):
   28         if name=='nosslcheck':
   29             self['context']=ssl._create_unverified_context()
   30         else:
   31             self[name]=value
   32     
   33     def is_http_config(self, name, value):
   34         if name.startswith('--'):
   35             name=name[2:]
   36         elif name.startswith('-'):
   37             name=name[1:]
   38             
   39         if 'http_' in name:
   40             name=name.replace("http_", '')
   41             self.save_keys(name, value)
   42             return True
   43         return False
   44     
   45     def __repr__(self):
   46         dev=''
   47         for key, value in self.items():
   48             dev+="%r = %r, "%(key, value)
   49         return dev
   50     
   51     
   52 httpConfig=HttpConfig()