Using requests.get is indeed very slow.
To check the balance of Bitcoin addresses in bulk, you would want an API that supports batch requests.
This would speed up the whole process since you can query multiple addresses within a single API call. The Blockchain.com API supports batch requests for address balances.
import requests
def fetch_balances(addresses):
address_list = '|'.join(addresses)
api_endpoint = f'https://blockchain.info/balance?active={address_list}'
response = requests.get(api_endpoint)
data = response.json()
for address, info in data.items():
balance = info['final_balance']
print(f"Address: {address}, Balance: {balance} ")
addresses = ['address1', 'address2', 'address3', ...]
fetch_balances(addresses)
A simple python script that would help you to fetch the balances of multiple addresses. The output would be in satoshis due to API of Blockchain.com