Skip to content

Conversation

@mgagliardo
Copy link

So testing the lib I found out there is no catching for timeout exception (i.e. the cluster is down, the IP is wrong, etc.), this PR fixes that.

>>> import urllib3
>>>
>>> from purestorage import FlashArray
>>> from purestorage import PureError
>>>
>>> urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
>>>
>>> timeout=10
>>> cluster="MYIP"
>>>
>>> try:
...     array = FlashArray(cluster, api_token="MY_TOKEN", request_kwargs={'timeout':timeout})
... except PureError as err:
...     print("PureError timeout while connecting to the cluster {0}. Error: {1}".format(cluster, err))
...

PureError timeout while connecting to the cluster MYIP. Error: PureError: HTTPSConnectionPool(host='MYIP', port=443): Max retries exceeded with url: /api/api_version (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x7f9a89b05128>, 'Connection to MYIP timed out. (connect timeout=10)'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant