Using cogniac version 2.0.14, the CogniacConnection object successfully authenticates to retrieve the application object, but when trying to submit consensus via the application.post_feedback method, it returns this error:
---------------------------------------------------------------------------
CredentialError Traceback (most recent call last)
/var/folders/4_/ckhxd12j3x5g6n_lscmhn1440000gq/T/ipykernel_23709/3363160765.py in <module>
----> 1 copy_application_consensus(original_application, new_application, start_time=1665068400)
/var/folders/4_/ckhxd12j3x5g6n_lscmhn1440000gq/T/ipykernel_23709/172188079.py in copy_application_consensus(original_application, new_application, start_time, end_time)
98 feedback['result'] = 'False'
99 app_feedback.append(feedback)
--> 100 new_application.post_feedback(media_id, subjects=app_feedback)
101 count += 1
102 left = total - count
~/opt/anaconda3/lib/python3.9/site-packages/retrying.py in wrapped_f(*args, **kw)
47 @six.wraps(f)
48 def wrapped_f(*args, **kw):
---> 49 return Retrying(*dargs, **dkw).call(f, *args, **kw)
50
51 return wrapped_f
~/opt/anaconda3/lib/python3.9/site-packages/retrying.py in call(self, fn, *args, **kwargs)
204
205 if not self.should_reject(attempt):
--> 206 return attempt.get(self._wrap_exception)
207
208 delay_since_first_attempt_ms = int(round(time.time() * 1000)) - start_time
~/opt/anaconda3/lib/python3.9/site-packages/retrying.py in get(self, wrap_exception)
245 raise RetryError(self)
246 else:
--> 247 six.reraise(self.value[0], self.value[1], self.value[2])
248 else:
249 return self.value
~/opt/anaconda3/lib/python3.9/site-packages/six.py in reraise(tp, value, tb)
717 if value.__traceback__ is not tb:
718 raise value.with_traceback(tb)
--> 719 raise value
720 finally:
721 value = None
~/opt/anaconda3/lib/python3.9/site-packages/retrying.py in call(self, fn, *args, **kwargs)
198 while True:
199 try:
--> 200 attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
201 except:
202 tb = sys.exc_info()
~/opt/anaconda3/lib/python3.9/site-packages/cogniac/app.py in post_feedback(self, media_id, subjects)
249 'subjects': subjects}
250
--> 251 self._cc._post("/1/applications/%s/feedback" % self.application_id, json=feedback_response)
252
253 ##
~/opt/anaconda3/lib/python3.9/site-packages/retrying.py in wrapped_f(*args, **kw)
47 @six.wraps(f)
48 def wrapped_f(*args, **kw):
---> 49 return Retrying(*dargs, **dkw).call(f, *args, **kw)
50
51 return wrapped_f
~/opt/anaconda3/lib/python3.9/site-packages/retrying.py in call(self, fn, *args, **kwargs)
210 if not self._wrap_exception and attempt.has_exception:
211 # get() on an attempt with an exception should cause it to be raised, but raise just in case
--> 212 raise attempt.get()
213 else:
214 raise RetryError(attempt)
~/opt/anaconda3/lib/python3.9/site-packages/retrying.py in get(self, wrap_exception)
245 raise RetryError(self)
246 else:
--> 247 six.reraise(self.value[0], self.value[1], self.value[2])
248 else:
249 return self.value
~/opt/anaconda3/lib/python3.9/site-packages/six.py in reraise(tp, value, tb)
717 if value.__traceback__ is not tb:
718 raise value.with_traceback(tb)
--> 719 raise value
720 finally:
721 value = None
~/opt/anaconda3/lib/python3.9/site-packages/retrying.py in call(self, fn, *args, **kwargs)
198 while True:
199 try:
--> 200 attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
201 except:
202 tb = sys.exc_info()
~/opt/anaconda3/lib/python3.9/site-packages/cogniac/cogniac.py in _post(self, url, timeout, **kwargs)
298 try:
299 resp = self.session.post(url, timeout=timeout, **kwargs)
--> 300 raise_errors(resp)
301 except CredentialError:
302 self.__authenticate()
~/opt/anaconda3/lib/python3.9/site-packages/cogniac/common.py in raise_errors(response)
51 if response.status_code == 401:
52 msg = "Invalid username password credentials (%d): %s" % (response.status_code, response.content)
---> 53 raise CredentialError(msg)
54
55 if response.status_code >= 400:
CredentialError: Invalid username password credentials (401): b'{"message":"Missing Bearer token in Authorization header."}\n'
Using cogniac version 2.0.14, the CogniacConnection object successfully authenticates to retrieve the application object, but when trying to submit consensus via the application.post_feedback method, it returns this error: