def hit(self, url): with count_queries('url:' + url): response = self.client.get(url) self.assertEqual(200, response.status_code) text = response.content.decode('utf-8') if response['Content-Type'] == 'application/json': return json.loads(text) else: return text
def hit(self, url, expected_status=200): with count_queries('url:' + url): response = self.client.get(url) self.assertEqual(expected_status, response.status_code) return response
def get_json(self, url): with count_queries('url:' + url): response = self.client.get_json(url) return response