Use pylint for zendesk_admin.py
This commit is contained in:
parent
e5460d90fc
commit
4666570177
@ -145,7 +145,7 @@ disable=print-statement,
|
|||||||
exception-escape,
|
exception-escape,
|
||||||
comprehension-escape,
|
comprehension-escape,
|
||||||
E5110,
|
E5110,
|
||||||
C045,
|
C0415,
|
||||||
|
|
||||||
|
|
||||||
# Enable the message, report, category or checker with the given id(s). You can
|
# Enable the message, report, category or checker with the given id(s). You can
|
||||||
@ -261,6 +261,9 @@ function-naming-style=snake_case
|
|||||||
|
|
||||||
# Good variable names which should always be accepted, separated by a comma.
|
# Good variable names which should always be accepted, separated by a comma.
|
||||||
good-names=i,
|
good-names=i,
|
||||||
|
id,
|
||||||
|
e,
|
||||||
|
n,
|
||||||
j,
|
j,
|
||||||
k,
|
k,
|
||||||
ex,
|
ex,
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
"""
|
||||||
|
Функционал работы администратора Zendesk.
|
||||||
|
"""
|
||||||
|
|
||||||
from typing import Optional, Dict
|
from typing import Optional, Dict
|
||||||
|
|
||||||
from zenpy import Zenpy
|
from zenpy import Zenpy
|
||||||
@ -35,7 +39,7 @@ class ZendeskAdmin:
|
|||||||
:param email: Email пользователя
|
:param email: Email пользователя
|
||||||
:return: Является ли зарегистрированным
|
:return: Является ли зарегистрированным
|
||||||
"""
|
"""
|
||||||
return True if self.admin.search(email, type='user') else False
|
return bool(self.admin.search(email, type='user'))
|
||||||
|
|
||||||
def get_user(self, email: str) -> ZenpyUser:
|
def get_user(self, email: str) -> ZenpyUser:
|
||||||
"""
|
"""
|
||||||
@ -85,9 +89,8 @@ class ZendeskAdmin:
|
|||||||
admin = Zenpy(**self.credentials)
|
admin = Zenpy(**self.credentials)
|
||||||
try:
|
try:
|
||||||
admin.search(self.credentials['email'], type='user')
|
admin.search(self.credentials['email'], type='user')
|
||||||
except APIException:
|
except APIException as invalid_data:
|
||||||
raise ValueError('invalid access_controller`s login data')
|
raise ValueError('invalid access_controller`s login data') from invalid_data
|
||||||
|
|
||||||
return admin
|
return admin
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user