Get information about a given domain.

        :param this_domain: a domain name.
        :param timeout: The amount of time in seconds the request should wait before timing out.

        :return: JSON response
166189
def get_domain_report(self, this_domain, timeout=None):
        
        params = {'apikey': self.api_key, 'domain': this_domain}

        try:
            response = requests.get(self.base + 'domain/report', params=params, proxies=self.proxies, timeout=timeout)
        except requests.RequestException as e:
            return dict(error=str(e))

        return _return_response_and_status_code(response)
913824
def domain_informations(domain, options={})
      response = connection.get do |req|
        req.url "insight/domains/#{domain}", options
      end
      return_error_or_body(response)
    end
121129
def _verify_or_create_domain(self):
        

        # Get all domains registered with the user
        r = requests.get(
            url=self.server + "/domains",
            auth=(self.username, self.password),
            headers=self.headers,
            json=self.data
        )
        if r.ok:
            names = []
            d = r.json()
            rdata = d["data"]
            if rdata:
                for d in rdata:
                    names.append(d["name"])
            if self.domain in names:
                return
        else:
            print "Error querying for domains for the configured user"
            print r.status_code, r.text
            return

        print "Domain %s is not created on rhcloud. Creating.."

        d = {"id": self.domain}
        d.update(self.data)

        r = requests.post(
            url= self.server + "/domains",
            auth= (self.username, self.password),
            headers = self.headers,
            json=d
        )
        if r.ok:
            print "Domain %s successfully created.." % self.domain

        else:
            print "Error creating domain for the configured user"
            print r.status_code, r.text
            return

        return r
407599
def get_service_info(self, type, name, timeout=3000):
        """"""
        info = ServiceInfo(type, name)
        if info.request(self, timeout):
            return info
        return None
1116024
def get_domains(self):
        
        url = self.API_TEMPLATE + self.DOMAINS
        data = self._get_json_from_response(url)

        domains = list()
        for item in data:
            domain = item['domain']
            domains.append(domain)
            self.logger.debug('Discovered domains: {}'.format(domain))

        return domains
695092
def get(cls, domain, name):
        
        Site = cls
        return Session.query(Site).filter(Site.domain == domain).filter(collate(Site.name, 'NOCASE') == name).first()
340715
def get(self, url):
        
        r = requests.get(self._format_url(url), headers=self.headers, timeout=TIMEOUT)
        self._check_response(r, 200)

        return r.json()
998134
def _get_zone(self, domain, domain_id):
        
        api = self.api[self.account]
        for request in api['zone']['GET']:
            url = (request.copy()).get('url', '/').replace('<id>', domain_id)
            params = request.get('params', {}).copy()
            for param in params:
                params[param] = params[param].replace('<id>', domain_id)
            response = self._get(url, query_params=params)
        dom = Provider._filter_dom(response.text, api['filter'])
        zone_file_filter = [{'name': 'textarea', 'attrs': {'name': api['zone']['file']}}]
        zone_file = Provider._filter_dom(dom, zone_file_filter).renderContents().decode('UTF-8')
        hidden = Provider._extract_hidden_data(dom)
        zone = {'data': dns.zone.from_text(zone_file, origin=domain, relativize=False),
                'hidden': hidden}
        LOGGER.info('Hetzner => Get zone for domain %s', domain)
        return zone
476667
def get_domain_name(url):
    
    if not url.startswith("http"):
        url = "http://" + url
    if not is_valid_url(url):
        raise ValueError("Invalid URL '%s'" % url)
    parse = urlparse(url)
    return parse.netloc
632182
def _ddns(self, ip):
        

        headers = {"Accept": "text/json", "User-Agent": "ddns/0.1.0 (imaguowei@gmail.com)"}

        data = {
            'login_token': self.login_token,
            'format': "json",
            'domain_id': self.domain_id,
            'record_id': self.record_id,
            'sub_domain': self.sub_domain,
            'record_line': '默认',
            'value': ip
        }

        res = requests.post(Ddns.DNSPOD_API, data, headers=headers)
        logger.debug(res.json())
        return res.json()['status']['code'] == '1'
334966
def destroy_domain(self, domain_id):
        
        json = self.request('/domains/%s/destroy' % domain_id, method='GET')
        status = json.get('status')
        return status
226285
def lookup_domains(self):
        
        thread_error = False
        thread_wait_timeout = 200
        ind = 1
        total_item_count = len(self.domains)
        for domain in self.domains:
            for nameserver in self.nameservers:
                wait_time = 0
                while threading.active_count() > self.max_threads:
                    time.sleep(1)
                    wait_time += 1
                    if wait_time > thread_wait_timeout:
                        thread_error = True
                        break

                if thread_error:
                    self.results["error"] = "Threads took too long to finish."
                    break
                log_prefix = "%d/%d: " % (ind, total_item_count)
                thread = threading.Thread(target=self.lookup_domain,
                                          args=(domain, nameserver,
                                                log_prefix))
                thread.setDaemon(1)

                thread_open_success = False
                retries = 0
                while not thread_open_success and retries < MAX_THREAD_START_RETRY:
                    try:
                        thread.start()
                        self.threads.append(thread)
                        thread_open_success = True
                    except:
                        retries += 1
                        time.sleep(THREAD_START_DELAY)
                        logging.error("%sThread start failed for %s, retrying... (%d/%d)" % (log_prefix, domain, retries, MAX_THREAD_START_RETRY))

                if retries == MAX_THREAD_START_RETRY:
                    logging.error("%sCan't start a new thread for %s after %d retries." % (log_prefix, domain, retries))

            if thread_error:
                break
            ind += 1

        for thread in self.threads:
            thread.join(self.timeout * 3)
        return self.results
728439
def get_status(self):
        
        url = self.base_url + '/status'
        try:
            r = requests.get(url, timeout=10)
            return r.json()
        except RequestException as err:
            raise Client.ClientError(err)
17307
def request(self, server=None):
        
        request = {
            "headers": {"Content-Type": "application/json"},
            "timeout": self._pump.timeout,
            "data": self.context,
        }

        url = "{proto}://{server}/{endpoint}".format(
            proto=self._pump.protocol,
            server=server or self.server,
            endpoint=self.ENDPOINT,
        )

        response = self._pump._requester(requests.post, url, **request)

        try:
            server_data = response.json()
        except ValueError:
            raise ClientException(response.content)

        if "error" in server_data:
            raise ClientException(server_data["error"], self.context)

        _log.debug("Client registration recieved: %(id)s %(secret)s %(expire)s", {
            "id": server_data["client_id"],
            "secret": server_data["client_secret"],
            "expire": server_data["expires_at"],
        })

        return server_data
643008
def get(self, timeout=None):
        
        if not self.wait(timeout):
            raise TimeoutError("Result not available within %fs" % timeout)
        if self._success:
            return self._data
        raise self._data[0]
666280
def extract_domain(host):
    
    host = re.sub('https?://', '', host)
    host = re.match('([^/]+)', host).groups()[0]
    domain = '.'.join(host.split('.')[-2:])
    if domain in _domains:
        domain = '.'.join(host.split('.')[-3:])
    return domain
327762
def get_domains(custom_headers:nil)
      response = get_domains_async(custom_headers:custom_headers).value!
      response.body unless response.nil?
    end