Improved error handling for API request
Added ``requests`` to dependencies