Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (36 sloc) 1.03 KB
import requests
import parse
'John Smyth',
'Michael Craig',
'Poppy-Mae Pate',
'Vivienne Rennie',
'Fathima Mccabe',
'Mai Cordova',
'Rocío García',
'Roman Sullivan',
'John Paul Smith',
"Séamus O'Carroll",
'Keagan Berg',
sorted_names = []
for name in NAMES:
data = {
'custname': name,
# Request the name from the server
result = requests.get('', json=data)
if result.status_code != 200:
raise Exception(f'Error accessing server: {result}')
# Obtain a raw name
raw_result = result.json()['data']
# Extract the name from the result
full_name ='"custname": "{name}"', raw_result)['name']
# Split it into first name and last name
first_name, last_name = full_name.split()
ready_name = f'{last_name}, {first_name}'
# Add the name in last_name, first_name format to the list
# Properly sort the list and display the result