python-redmine icon indicating copy to clipboard operation
python-redmine copied to clipboard

Catch AuthError

Open vergelli opened this issue 4 years ago • 1 comments

Hello, I'm trying to catch an Auth Error when I try to make this:

   redmine = Redmine(  connection.REDMINE_URL, 
                version=connection.REDMINE_VERSION, 
                username=connection.REDMINE_USER, 
                password=connection.REDMINE_PASSWORD,  
                requests={'verify': False}
                    )

Of course, it returns :

...
...
...
    raise exceptions.AuthError
redminelib.exceptions.AuthError: Invalid authentication details

When credentials are incorrect, I'd like to catch this error. ¿What can I do?

vergelli avatar May 09 '21 20:05 vergelli

from redminelib import exceptions

try:
    redmine = Redmine(.....)
except exceptions.AuthError:
    print('ooops, we just caught AuthError')

that's basically how you would catch any other Python exception

maxtepkeev avatar May 12 '21 14:05 maxtepkeev

Closing this due to inactivity.

maxtepkeev avatar Dec 28 '22 13:12 maxtepkeev