Hi,
I've had a regular scheduled task that, based on the day of the week, sends out an SMS text to whoever is signed up to receive it. This sign-up data is kept in an Airtable table that I'm connecting to with the API.
It's been running fine for a few days, and then on saturday I got the following error message:
Traceback (most recent call last):
File "/home/andrewglynch/dailycheckin/twilio_loop_script.py", line 49, in <module>
if records['fields']['Subscription_status']=='Subscribed' and records['fields']['Weekend_texts']=='Yes':
KeyError: 'Subscription_status'
The error suggests that it can't find the field 'Subscription_status' in the airtable field.
But if I print out the full airtable export, the field is clearly there, as Subscription_status. When I copy this exact text, and paste it over the line where python was erroring and then run the script again, it runs successfully.
Anyone know what's causing this? I don't understand why it's not running properly 100% of the time even though the code itself is accurate.