Added better http error handling in connection.py. Updated tests in basic.py.