I'm trying to pass the following data into POST request:
data = {
"To": MY_PHONE_NUMBER,
"From": TWILIO_PHONE_NUMBER,
"Parameters": f'{"appointment_time":{apointment_time}, "name":{name_var}, "age":{age_var}}',
}
I'm getting the following error:
"Parameters": f'{"appointment_time":{apointment_time}, "name":{name_var}, "age":{age_var}}',
ValueError: Invalid format specifier
I've tried using .format as well with no luck.
In an f string it interprets the brace as preceding a variable. The braces you included for formatting are confusing the parser. Use two braces to escape it.
"Parameters": f'{{"appointment_time":{apointment_time}, "name": {name_var}, "age":{age_var}}}'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With