Check a couple of things:
Did you fill the following settings in your config file of bitcoin core (bitcoin.conf, on linux in .bitcoin-folder):
server=1
rpcpassword=<password>
rpcuser=<user>
You should fill in the <password> and <user> values with your own.
If you want to be able to also get transaction info on addresses not in your wallet you also want to add txindex to your bitcoin.conf file:
Fire up bitcoind:
Check to see if you can use rpc calls from the commandline:
curl --user <user>:<password> --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getblockcount","params":[]}' -H 'content-type:text/plain;' http://127.0.0.1:8332
Where you use the same <user> and <password> as included in your bitcoin.conf file
If all works fine, you can setup things for Python, First install the bitcoin-rpc package (I assume you use python3):
sudo pip3 install bitcoinrpc
And finally connect from python:
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
rpc_connection = AuthServiceProxy("http://%s:%s@127.0.0.1:8332"%("<user>", "<password>"),timeout = 120)
print('You are synced up to block %s) , % rpc_connection.getblockcount())
And once again, replace the <user> and <password> with your own settings.