Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

[Off Topic] How to loop the Airtable and API data?

233 0
Showing results for 
Search instead for 
Did you mean: 


api_endpoint = ‘xxx’
json_data = requests.get(api_endpoint).json()
cryptodata = json_data[‘data’]

records = airtable.get_all(maxRecords=1000)

for r in records:
for currency in cryptodata:
if (r[‘fields’][‘name’] == currency[‘name’]):
records = airtable.update_by_field(‘name’, currency[‘name’], {‘price’: currency[‘metrics’][‘market_data’][‘price_usd’]})
Hello, I’m a newbie to Python. When the API transmits data to Airtable, the preceding code is meant to update the data in Airtable.


How can it only UPDATE if a name already exists?

If there is no existing name, how can it ADD ONLY?

This is the code I use to see if any are already in use:
for r in records:
for currency in cryptodata:
if (r[‘fields’][‘name’] == currency[‘name’])

0 Replies 0