{"action":"created","issue":{"url":"https://api.github.com/repos/Mashape/unirest-python/issues/21","labels_url":"https://api.github.com/repos/Mashape/unirest-python/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/Mashape/unirest-python/issues/21/comments","events_url":"https://api.github.com/repos/Mashape/unirest-python/issues/21/events","html_url":"https://github.com/Mashape/unirest-python/issues/21","id":50115310,"number":21,"title":"Handling of poor connection or failed connections","user":{"login":"TravisJoe","id":2984346,"avatar_url":"https://avatars.githubusercontent.com/u/2984346?v=3","gravatar_id":"","url":"https://api.github.com/users/TravisJoe","html_url":"https://github.com/TravisJoe","followers_url":"https://api.github.com/users/TravisJoe/followers","following_url":"https://api.github.com/users/TravisJoe/following{/other_user}","gists_url":"https://api.github.com/users/TravisJoe/gists{/gist_id}","starred_url":"https://api.github.com/users/TravisJoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TravisJoe/subscriptions","organizations_url":"https://api.github.com/users/TravisJoe/orgs","repos_url":"https://api.github.com/users/TravisJoe/repos","events_url":"https://api.github.com/users/TravisJoe/events{/privacy}","received_events_url":"https://api.github.com/users/TravisJoe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-11-26T03:55:27Z","updated_at":"2015-08-27T14:16:58Z","closed_at":null,"body":"Hello,\r\n\r\nI will be honest I am not the most knowledgeable with web communication. I mostly deal with hardware communication like RS232, RS485, CAN and other serial communication often used in embedded systems. This is one thing that attached me to this library, that and simple asynchronous communication. \r\n\r\nMy question is I am dealing with a situation with poor and intermittent wireless connections. When using unirest it appears to throw exceptions when it is unable to connect. I don't seem to be able to catch this exception in a way that I can handle it is no internet or timeout, at least not when trying to use the callback function. For now I use a basic function to connect using a normal socket and if it fails I do not try to post data with unirest. \r\n\r\nI know I am probably missing something important due to my lack of experience, so I am asking your thoughts on how I should handle this situation. \r\n\r\nI am using an embedded linux system that is single cored, which is how I found your library since it has non-blocking asynchronous calls. I am using mobile wifi as my communication path to the server.\r\n\r\nAny input would be helpful on how to best achieve a more robust solution. \r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/Mashape/unirest-python/issues/comments/135448600","html_url":"https://github.com/Mashape/unirest-python/issues/21#issuecomment-135448600","issue_url":"https://api.github.com/repos/Mashape/unirest-python/issues/21","id":135448600,"user":{"login":"TravisJoe","id":2984346,"avatar_url":"https://avatars.githubusercontent.com/u/2984346?v=3","gravatar_id":"","url":"https://api.github.com/users/TravisJoe","html_url":"https://github.com/TravisJoe","followers_url":"https://api.github.com/users/TravisJoe/followers","following_url":"https://api.github.com/users/TravisJoe/following{/other_user}","gists_url":"https://api.github.com/users/TravisJoe/gists{/gist_id}","starred_url":"https://api.github.com/users/TravisJoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TravisJoe/subscriptions","organizations_url":"https://api.github.com/users/TravisJoe/orgs","repos_url":"https://api.github.com/users/TravisJoe/repos","events_url":"https://api.github.com/users/TravisJoe/events{/privacy}","received_events_url":"https://api.github.com/users/TravisJoe/received_events","type":"User","site_admin":false},"created_at":"2015-08-27T14:16:58Z","updated_at":"2015-08-27T14:16:58Z","body":"From my looking around and testing unirest is only catching some of the issues with\r\n\r\n```python\r\nexcept urllib2.HTTPError, e:\r\n            response = e\r\n```\r\n\r\nAnd you might need to add (see below) after the HTTPError to catch anything else the urllib2 might throw. \r\n\r\n```python\r\nexcept urllib2.URLError as e:\r\n    response = e\r\n````\r\n"}}