Search code examples
pythongetrequestpython-requests

Get request API


I use API:

https://www.blockchain.com/api/q

Trying to make a Get request:

url = 'https://www.blockchain.info/api/q/getreceivedbyaddress/' + strpod + '?confirmations=6'
zapros = requests.get(url)

But it returns the entire page.

And I only need the balance value.

Please help me.


Solution

  • import requests 
    address = "17LREmmnmTxCoFZ59wfhg4S639GsPqjTRT"
    URL = "https://blockchain.info/q/getreceivedbyaddress/"+address+"?confirmations=6"
    r = requests.get(url = URL) 
      
    # extracting balance ((in satoshi))
    bt_balance = r.json()

    enter image description here

    The API link is not wrong. Please check with the blockchain addresss