Why do I have a socket.timeout with python-bitcoinlib?
Change the timeout inside the file bitcoin.conf or when you start the bitcoind,

This is an example

##
## bitcoin.conf configuration file. Lines beginning with # are comments.
##
# On client-side, you add the normal user/password pair to send commands:
rpcuser=alice
rpcpassword=bob
rpcclienttimeout=200


or you can run the bitcoind with this command bitcoind -rpcuser=alice -rpcpassword=bob -rpcclienttimeout=200

Or you can change the setting lib to the code, try this example

from bitcoin.rpc import RawProxy

# Create a connection to local Bitcoin Core node
p = RawProxy(None, None, None, 120)

# Run the getblockchaininfo command, store the resulting data in info
info = p.getblockchaininfo()

# Retrieve the 'blocks' element from the info
print(info['blocks'])