for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
from plugin.api.core.exceptions import ApiError
from plugin.api.core.manager import ApiManager
manager
plugin.api.core
This can be caused by one of the following:
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
# .scrutinizer.yml before_commands: - sudo pip install abc # Python2 - sudo pip3 install abc # Python3
This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.
__init__.py
from plugin.core.helpers import decorator
import logging
log = logging.getLogger(__name__)
class AuthenticationRequiredError(ApiError):
code = 'authentication.required'
message = 'API authentication required'
class ServiceMeta(type):
def __init__(cls, name, bases, attributes):
super(ServiceMeta, cls).__init__(name, bases, attributes)
if '__metaclass__' in attributes:
return
# Register API service
ApiManager.register(cls)
class Service(object):
__metaclass__ = ServiceMeta
__key__ = None
manager = None
def __init__(self, manager):
self.manager = manager
@property
def context(self):
return self.manager.context
@decorator.wraps
def expose(authenticated=True):
def outer(func):
def inner(self, *args, **kwargs):
if authenticated and self.context.token is None:
raise AuthenticationRequiredError
return func(self, *args, **kwargs)
# Attach meta to wrapper
inner.__meta__ = {
'authenticated': authenticated,
'exposed': True
}
return inner
return outer