use requests and requests-oauthlib to simplify code and make it Python 3 compatible