def request(self, batch, attempt=0): """Attempt to upload the batch and retry before raising an error """ try: post(self.key, self.secret, self.url, batch=batch) except: if attempt > self.retries: raise self.request(batch, attempt+1)
def request(self, batch, attempt=0): """Attempt to upload the batch and retry before raising an error """ try: post(self.key, self.secret, self.url, batch=batch) except: if attempt > self.retries: raise self.request(batch, attempt + 1)
def test_valid_request(self): res = post('key', 'secret', debug=True, batch=[{ 'contact_uid': 'contact_uid', 'method': 'set_contact' }]) self.assertEqual(res.status_code, 201)