Binance API no longer working in Streamlit Cloud

For some reason, the Binance API is no longer working when you deploy an app that uses it in Streamlit Cloud.

I wrote this code:

import requests
import json
import streamlit as st

def get_orders(pair, depth):
    response = requests.get(f'https://api.binance.com/api/v3/depth?symbol={pair}&limit={depth}')
    byte_json = response.content
    orders_json = json.loads(byte_json)
    return orders_json

st.write(get_orders('BTCBUSD', 5))

On my computer, it works perfectly.

But when I run in Streamlit Cloud, I receive that error.
image
It worked in September of 2022, but is no longer working.

Does anyone know any workaround that I can use to solve that?

For this specific case (server in the US), use binance.us instead of binance.us.

This seems to be not documented at all but it worked for me.

The solution is to use https://data.binance.com/api/v3 instead of https://binance.com/api/v3

I tried but not worked here.

I deployed a test application:
https://binance-api.streamlit.app/

Both https://api.binance.us and https://data.binance.com work from Streamlit Cloud, but they return different data. In my tests from a non-restricted location https://api.binance.com returned the same data as https://api.binance.us.