app/lists.py
async def enable_proxy(self):
        """Enables a proxy server.

        Requests are proxied through US Proxies to prevent MailChimp
        blocks. This is an accepted technique among integrators and
        does not violate MailChimp's Terms of Service.
        """

        # Don't use a proxy if environment variable is set, e.g. in development
        if os.environ.get('NO_PROXY'):
            self.logger.info(
                'NO_PROXY environment variable set. Not using a proxy.')
            return

        # Get the worker number for this Celery worker
        # We want each worker to control its corresponding proxy process
        # Note that workers are zero-indexed, proxy procceses are not
        process = current_process()

        # Fall back to proxy #1 if we can't ascertain the worker index
        # e.g. anyone hacking with this app on windows
        try:
            proxy_process_number = str(process.index + 1)
        except AttributeError:
            proxy_process_number = '1'

        # Use the US Proxies API to get the proxy info
        proxy_request_uri = 'http://us-proxies.com/api.php'
        proxy_params = (
            ('api', ''),
            ('uid', '9557'),
            ('pwd', os.environ.get('PROXY_AUTH_PWD')),
            ('cmd', 'rotate'),
            ('process', proxy_process_number),
        )

        try:
            proxy_response = requests.get(proxy_request_uri,
                                          params=proxy_params)
            proxy_response_vars = proxy_response.text.split(':')

            # Set the proxy for requests from this worker
            # Keep as None (i.e, use the server's IP)
            # Only if we have an issue with the proxy provider
            if proxy_response_vars[0] != 'ERROR':
                self.proxy = ('http://{}:{}'.format(
                    proxy_response_vars[1], proxy_response_vars[2]))

        # If proxy provider is unreachable, don't use a proxy
        except ConnError:
            proxy_response_vars = None

        # Allow some time for the proxy server to boot up
        # We don't need to wait if we're not using a proxy
        if self.proxy:
            self.logger.info('Using proxy: %s', self.proxy)
            await asyncio.sleep(self.PROXY_BOOT_TIME)
        else:
            self.logger.warning('Not using a proxy. Reason: %s.',
                                proxy_response_vars[2] if
                                proxy_response_vars else
                                'ConnectionError: proxy provider down.')
Enables a proxy server.

        Requests are proxied through US Proxies to prevent MailChimp
        blocks. This is an accepted technique among integrators and
        does not violate MailChimp's Terms of Service.
        
Enables a proxy server.
Requests are proxied through US Proxies to prevent MailChimp
blocks. This is an accepted technique among integrators and
does not violate MailChimp's Terms of Service.
Enables a proxy server . Requests are proxied through US Proxies to prevent MailChimp blocks . This is an accepted technique among integrators and does not violate MailChimp ' s Terms of Service .
async def enable_proxy(self):
        if os.environ.get('NO_PROXY'):
            self.logger.info(
                'NO_PROXY environment variable set. Not using a proxy.')
            return
        process = current_process()
        try:
            proxy_process_number = str(process.index + 1)
        except AttributeError:
            proxy_process_number = '1'
        proxy_request_uri = 'http://us-proxies.com/api.php'
        proxy_params = (
            ('api', ''),
            ('uid', '9557'),
            ('pwd', os.environ.get('PROXY_AUTH_PWD')),
            ('cmd', 'rotate'),
            ('process', proxy_process_number),
        )
        try:
            proxy_response = requests.get(proxy_request_uri,
                                          params=proxy_params)
            proxy_response_vars = proxy_response.text.split(':')
            if proxy_response_vars[0] != 'ERROR':
                self.proxy = ('http://{}:{}'.format(
                    proxy_response_vars[1], proxy_response_vars[2]))
        except ConnError:
            proxy_response_vars = None
        if self.proxy:
            self.logger.info('Using proxy: %s', self.proxy)
            await asyncio.sleep(self.PROXY_BOOT_TIME)
        else:
            self.logger.warning('Not using a proxy. Reason: %s.',
                                proxy_response_vars[2] if
                                proxy_response_vars else
                                'ConnectionError: proxy provider down.')
async def enable_proxy ( self ) : if os . environ . get ( 'NO_PROXY' ) : self . logger . info ( 'NO_PROXY environment variable set. Not using a proxy.' ) return process = current_process ( ) try : proxy_process_number = str ( process . index + 1 ) except AttributeError : proxy_process_number = '1' proxy_request_uri = 'http://us-proxies.com/api.php' proxy_params = ( ( 'api' , '' ) , ( 'uid' , '9557' ) , ( 'pwd' , os . environ . get ( 'PROXY_AUTH_PWD' ) ) , ( 'cmd' , 'rotate' ) , ( 'process' , proxy_process_number ) , ) try : proxy_response = requests . get ( proxy_request_uri , params = proxy_params ) proxy_response_vars = proxy_response . text . split ( ':' ) if proxy_response_vars [ 0 ] != 'ERROR' : self . proxy = ( 'http://{}:{}' . format ( proxy_response_vars [ 1 ] , proxy_response_vars [ 2 ] ) ) except ConnError : proxy_response_vars = None if self . proxy : self . logger . info ( 'Using proxy: %s' , self . proxy ) await asyncio . sleep ( self . PROXY_BOOT_TIME ) else : self . logger . warning ( 'Not using a proxy. Reason: %s.' , proxy_response_vars [ 2 ] if proxy_response_vars else 'ConnectionError: proxy provider down.' )
Enables a proxy server.
Enables a proxy server .
"""Enables a proxy server.

        Requests are proxied through US Proxies to prevent MailChimp
        blocks. This is an accepted technique among integrators and
        does not violate MailChimp's Terms of Service.
        """ # Don't use a proxy if environment variable is set, e.g. in development
 # Get the worker number for this Celery worker
 # We want each worker to control its corresponding proxy process
 # Note that workers are zero-indexed, proxy procceses are not
 # Fall back to proxy #1 if we can't ascertain the worker index
 # e.g. anyone hacking with this app on windows
 # Use the US Proxies API to get the proxy info
 # Set the proxy for requests from this worker
 # Keep as None (i.e, use the server's IP)
 # Only if we have an issue with the proxy provider
 # If proxy provider is unreachable, don't use a proxy
 # Allow some time for the proxy server to boot up
 # We don't need to wait if we're not using a proxy

self