EdinburghGenomics / pyclarity-lims

Python interface to the GenoLogics LIMS server via its REST API.
MIT License
11 stars 4 forks source link

Fix AttributeError in Lims.get #57

Closed kmendler closed 2 years ago

kmendler commented 2 years ago

Problem

Thank you for maintaining this tool! I just found one small bug. I was testing the behaviour of lims.get(...) when the connection was not possible (ie. bad URL or credentials) and was expecting a ConnectionError but got an AttributeError instead:

except requests.exceptions.ConnectionError as e:
    raise type(e)("{0}, Error trying to reach {1}".format(e.message, uri))
    AttributeError: 'ConnectionError' object has no attribute 'message'

Environment

I was running Python 3.9 and requests==2.27.1

Solution

I've changed it so that the ConnectionError is correctly raised.

mwhamgenomics commented 2 years ago

Hi there, sorry for the delay! Looks like an old holdover from Python 2. Have just tried, and the fix does indeed work in 2 and 3.

It does raise a question of how to continue supporting this repo though - see #58