def devices(self): """ Get data from cmdb """ headers = {'useragent': self.useragent} res = requests.get(self.__endpoint( 'devices?embedded={"ip_addresses":1,"site.name":1}'), headers=headers) return res.json()['_items']
def devices(self): """ Get data from cmdb """ headers = { 'useragent': self.useragent } res = requests.get( self.__endpoint('devices?embedded={"ip_addresses":1,"site.name":1}'), headers=headers) return res.json()['_items']
def test_getting_getting_a_service(): c = consul.Consul() c.agent.service.register('httpd', port=80) response = requests_srv.get('http://_httpd._tcp.service.consul/index.html') assert response.status_code == 200
def test_unknown_domain(): with pytest.raises(requests.ConnectionError) as excinfo: response = requests_srv.get('http://_foobar._tcp.service.consul/index.html') assert 'DNS error: NXDOMAIN' in excinfo.value
def test_unknown_domain(): with pytest.raises(requests.ConnectionError) as excinfo: response = requests_srv.get( 'http://_foobar._tcp.service.consul/index.html') assert 'DNS error: NXDOMAIN' in excinfo.value