Skip to content

Commit

Permalink
move keyboard interrup to correct location
Browse files Browse the repository at this point in the history
  • Loading branch information
SlowMo24 committed Sep 3, 2024
1 parent eeab650 commit 139cdef
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions ohsome/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,13 @@ def _handle_request(self) -> OhsomeResponse:
def _post_request(self) -> Response:
try:
response = self._session().post(url=self._url, data=self._parameters)
except KeyboardInterrupt:
raise OhsomeException(
message="Keyboard Interrupt: Query was interrupted by the user.",
url=self._url,
params=self._parameters,
error_code=440,
)
except requests.exceptions.ConnectionError as e:
raise OhsomeException(
message="Connection Error: Query could not be sent. Make sure there are no network "
Expand Down Expand Up @@ -388,14 +395,6 @@ def _check_response(self, response: Response) -> None:
response=e.response,
)

except KeyboardInterrupt:
raise OhsomeException(
message="Keyboard Interrupt: Query was interrupted by the user.",
url=self._url,
params=self._parameters,
error_code=440,
)

def _get_response_data(self, response: Response) -> dict:
try:
return response.json()
Expand Down

0 comments on commit 139cdef

Please sign in to comment.