What is causing the requests code to fail?