How advisable is using the following code to query the bitcoin core as compared to using some python RPC library.
import os
btc_prefix = 'bitcoin-cli '
def getblockcount(btc_prefix):
print("in getblockcount")
cmd = ' '.join([btc_prefix, 'getblockcount'])
response = os.popen(cmd).read()
return int(response)
getblockcount(btc_prefix)
It is kind of a wrapper function for the core API's. What are the drawbacks/advantages of using the above code. Also, does it affect security in anyway.