Updated code to work with new requests module