D
D
DIASWORD2021-05-24 18:04:38
Python
DIASWORD, 2021-05-24 18:04:38

How to work with api through a proxy?

I will describe very simply
Here is the code that receives the data directly

def getBalance(addr):
    try:
        response = requests.get(
            f'https://api.smartbit.com.au/v1/blockchain/address/{addr}')
        return (
            Decimal(response.json()["address"]["total"]["balance"])
        )
    except:
        pass

How would I make it all work through the proxy list?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dEN__5, 2021-05-24
@dEN__5

requests.get(
            f'https://api.smartbit.com.au/v1/blockchain/address/{addr}',proxies=dict)

kite to help

W
Wispik, 2021-05-24
@Wispik

Official documentation
and here it is described how to sort them out

spoiler

ну научитесь же наконец-то элементарные вещи в гугле искать

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question