in utils/wheel_feeder.py [0:0]
def _upload_participant(self, participant_details, full_wheel_url):
"""
Stores one participant using the Wheels API
:param participant_details: 2 elements list: [<name>, <url>]
:type participant_details: list
:param full_wheel_url: Full URL of the Wheel
:type full_wheel_url: str
"""
participant_name = participant_details[0]
participant_url = participant_details[1]
headers = {
'content-type': 'application/json',
'authorization': self._authentication.id_token
}
payload = {'id': '', 'name': participant_name, 'url': participant_url}
print('-------------------------------------------------------------')
print('Uploading Participant:')
print(f' - name: {participant_name}')
print(f' - url: {participant_url}')
try:
r = requests.post(
full_wheel_url,
data=json.dumps(payload),
headers=headers
)
if r.status_code in self.STATUS_CODES_SUCCESS:
print('Upload successful')
else:
print(f'Upload was not successful. Status Code: {r.status_code}')
except Exception as e:
print(f'There was an error during upload of the participant:')
print(f' - name: {participant_name}')
print(f' - url: {participant_url}')
print(f'Following error has been raised: {e}')