Get the current IP Tor is using.

        :returns str
        :raises TorIpError
421891
def get_current_ip(self):
        
        response = get(ICANHAZIP, proxies={"http": self.local_http_proxy})

        if response.ok:
            return self._get_response_text(response)

        raise TorIpError("Failed to get the current Tor IP")
38890
def get_ips(self):
        
        res = self.get_request('/ip_address')
        IPs = IPAddress._create_ip_address_objs(res['ip_addresses'], cloud_manager=self)
        return IPs
1208240
def get_instance_private_ip_from_route(instance, route):
    
    ipaddr = None
    for eni in instance.interfaces:
        if eni.id == route.interface_id:
            ipaddr = eni.private_ip_address
            break
    return ipaddr, eni if ipaddr else None
889054
def detect(self):
        
        theip = find_ip(family=self.opts_family)
        self.set_current_value(theip)
        return theip
444085
def get_public_ip(self, addr_family=None, *args, **kwargs):
        """"""
        return self.get_ip('public', addr_family, *args, **kwargs)
651882
def get_ip(source='aws'):
    
    '''  '''
    
    if source == 'aws':
        source_url = 'http://checkip.amazonaws.com/'
    else:
        raise Exception('get_ip currently only supports queries to aws')
    
    import requests
    try:
        response = requests.get(url=source_url)
    except Exception as err:
        from labpack.handlers.requests import handle_requests
        from requests import Request
        request_object = Request(method='GET', url=source_url)
        request_details = handle_requests(request_object)
        raise Exception(request_details['error'])
    current_ip = response.content.decode()
    current_ip = current_ip.strip()
    
    return current_ip
513505
def current(cls, service, port):
        
        host = socket.getfqdn()
        return cls(
            host=host,
            ip=socket.gethostbyname(host),
            port=port,
            metadata=service.metadata
        )
1155732
def get_external_ip(self):
        

        random.shuffle(self.server_list)
        myip = ''
        for server in self.server_list[:3]:
            myip = self.fetch(server)
            if myip != '':
                return myip
            else:
                continue
        return ''
501839
def check_ip(self):
        
        # For reverse proxy (nginx)
        forwarded_for = self.request.headers.get('X-Forwarded-For', None)
        if forwarded_for:
            return forwarded_for, _check_ip(forwarded_for)

        # For default method
        peer_name = self.request.transport.get_extra_info('peername')
        if peer_name is not None:
            host, _ = peer_name
            return host, _check_ip(host)

        # Not allowed and can't get client IP
        return None, False
909545
def _get_local_ip():
        
        return set([x[4][0] for x in socket.getaddrinfo(
            socket.gethostname(),
            80,
            socket.AF_INET
        )]).pop()
998507
def getResponse(self, url):
             
        # Defining an empty object for the response
        response = {}
        try:
            # This receives only the parameters needed by this Tor Wrapper:
            # {
            #    "host" : "127.0.0.1"
            #    "port" : "9150"
            # }  
            self.info = self._getConfiguration()
        
            response = self._grabContentFromUrl(url)
        except Exception, e:
            response["status"] = { "code" : 400, "desc" : str(e) }            
            
        # Adding other known data            
        response["time_processed"] = str(dt.datetime.now())
        
        response["domain"] = self.getDomainFromUrl(url)
        response["url"] = url          

        try:
            # We'll check if something happened...    
            response["status"]
        except Exception, e:
            # If nothing happened till now, we'll set the code as 200             
            response["status"] = { "code" : 200, "desc" : "OK." }
                    
        return response
1315402
def get_ip(host):
    '''
    
    '''
    hosts = _list_hosts()
    if not hosts:
        return ''
    # Look for the op
    for addr in hosts:
        if host in hosts[addr]:
            return addr
    # ip not found
    return ''
604995
def get(self):
        """"""
        q = queue.Queue()

        for u, j, k in urls:
            t = threading.Thread(target=self._get_ip_public, args=(q, u, j, k))
            t.daemon = True
            t.start()

        timer = Timer(self.timeout)
        ip = None
        while not timer.finished() and ip is None:
            if q.qsize() > 0:
                ip = q.get()

        return ', '.join(set([x.strip() for x in ip.split(',')]))
934281
def vt_ip_check(ip, vt_api):
    """"""
    if not is_IPv4Address(ip):
        return None

    url = 'https://www.virustotal.com/vtapi/v2/ip-address/report'
    parameters = {'ip': ip, 'apikey': vt_api}
    response = requests.get(url, params=parameters)
    try:
        return response.json()
    except ValueError:
        return None
1138462
def show_network_ip_availability(self, network, **_params):
        """"""
        return self.get(self.network_ip_availability_path % (network),
                        params=_params)
903338
def get_ip(request):
    
    if config.BEHIND_REVERSE_PROXY:
        ip_address = request.META.get(config.REVERSE_PROXY_HEADER, '')
        ip_address = ip_address.split(",", 1)[0].strip()
        if ip_address == '':
            ip_address = get_ip_address_from_request(request)
    else:
        ip_address = get_ip_address_from_request(request)
    return ip_address
1006518
def get_location(self):
        
        if self._location:
            return succeed(self._location)
        if self.ip != 'unknown':
            self._location = NetLocation(self.ip)
        else:
            self._location = NetLocation(None)
        if not self._location.countrycode and self.ip != 'unknown':
            # see if Tor is magic and knows more...
            d = self.controller.get_info_raw('ip-to-country/' + self.ip)
            d.addCallback(self._set_country)
            d.addCallback(lambda _: self._location)
            return d
        return succeed(self._location)