Вот упрощенная версия моего текущего синхронного подхода:
Код: Выделить всё
import requests
# Initial request to get the ID
response = requests.get('https://api.example.com/get_id')
id = response.json()['id']
# Subsequent requests to get data related to the ID
data1 = requests.get(f'https://api.example.com/data/{id}/info1').json()
data2 = requests.get(f'https://api.example.com/data/{id}/info2').json()
data3 = requests.get(f'https://api.example.com/data/{id}/info3').json()
# Processing the data
process_data(data1, data2, data3)
Я изучил httpx, но не уверен, как правильно структурировать код. Будем очень признательны за любую помощь или пример кода!
Подробнее здесь: https://stackoverflow.com/questions/786 ... -in-python