Packages.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:Proxifier 作者: donjajo 项目源码 文件源码
def Unset( self ):
        if self.package_installed( 'wget' ):
            print( '\r\n\r\n[WGET]' )
            if self.verbose:
                print( '%s Wget is installed, opening %s for writing ' % ( self.date(), self.wgetrc ) )
            try:
                config = ConfigObj( self.wgetrc )
                if config.has_key( 'http_proxy' ): 
                    del config[ 'http_proxy' ]
                if config.has_key( 'https_proxy' ):
                    del config[ 'https_proxy' ]
                if config.has_key( 'ftp_proxy' ):
                    del config[ 'ftp_proxy' ]

                config[ 'use_proxy' ] = 'off'
                config.write( open( self.wgetrc, 'w' ) )
                if self.verbose:
                    print( '%s Proxy configuration removed successfully from %s ' % ( self.date(), self.wgetrc ) )
            except ( IOError, ConfigObjError ), e:
                print( 'Unable to unset wget proxy: Error reading wget config in \'%s\' - %s' % ( self.wgetrc, e ) )
                os.exit( 1 )
        else:
            print( '%s Wget not installed, skipping' % self.date() )
        super( Wget, self ).Unset()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号