Please help, please answer

Hello! I’m new to programming, please help. How to check the balance of a private key bitcoin? Or get an address from it? Available 400 keys.
Sorry if not in that section wrote.

script  

#!/usr/bin/python
from pybitcoin import BitcoinPrivateKey
import requests
import json

FILE_PATH = r'C:\Users\user\Desktop\keys.txt'

with open(FILE_PATH) as f:
    keys = f.read().splitlines()

for key in keys:
    private_key = BitcoinPrivateKey(private_key=key.)

public_key = private_key.public_key()
address = public_key.address()

r = requests.get('https://chain.so/api/v2/address/BTC/{}'.format(address))
print ('Address: {} Private Key: {} Balance: {}'.format(address, key, (json.loads(r.content)['data']['balance'])))

screen   script errors