Python Script pull data from Blockchain JSON

I am trying to write a python script that will take a bitcoin address and show how many transactions have been processed at that address. I can pull out the JSON data and print it to the screen, but I can't figure out how to do it so that I go to that data and pull out the "n_tx" potion. Here is what I have so far, basic, but it shows that I have pulled in the correct data.

import requests
import json

r = requests.get('http://blockchain.info/rawaddr/1MtKaahhBAwc1Bs9JLgh2tTAmvHL4kauRb')

print r.json()

      

I have read several tutorials and tried many different ideas and I am sure this is a simple solution that my brain just cannot figure out today.

Ultimately I would like to get the following on screen: 1MtKaahhBAwc1Bs9JLgh2tTAmvHL4kauRb has 0 transactions

Thanks in advance.

+3


source to share


1 answer


Do you mean something like this?



print r.json()['address'],' has ', r.json()['n_tx'], 'transactions'

      

+3


source







All Articles