code cleanup, use requests and blockchain's json api.