def _find_class_by_name(self, pb_classname):
     pb_classname = self._classname_aliases.get(pb_classname, None) \
         or pb_classname
     try:
         return filter(
             lambda c: c.__name__ == pb_classname, Pb.__subclasses__()
         )[0]
     except IndexError:
         raise InvalidUsage('No such api', status_code=410)
Beispiel #2
0
 def execute(self):
     """calls the associated api"""
     if OFFLINE:
         sys.path.append("./photoblaster")
         from photoblaster.modules import Pb as _Pb
         from photoblaster.config import LOCAL as PBLOCAL
         for pbcls in _Pb.__subclasses__():
             if pbcls.__name__ == self.__class__.__name__:
                 params_dict = self.as_dict()
                 instance = pbcls(**params_dict)
                 instance.create()
                 if not PBLOCAL:
                     instance.file_s3move()
                 instance.db_send()
                 return instance.file_dict()
     return json.loads(utils.http_request(self._url, params=self.as_dict()))
Beispiel #3
0
 def execute(self):
     """calls the associated api"""
     if OFFLINE:
         sys.path.append("./photoblaster")
         from photoblaster.modules import Pb as _Pb
         from photoblaster.config import LOCAL as PBLOCAL
         for pbcls in _Pb.__subclasses__():
             if pbcls.__name__ == self.__class__.__name__:
                 params_dict = self.as_dict()
                 instance = pbcls(**params_dict)
                 instance.create()
                 if not PBLOCAL:
                     instance.file_s3move()
                 instance.db_send()
                 return instance.file_dict()
     return json.loads(
         utils.http_request(self._url, params=self.as_dict())
     )
#!/usr/bin/python2.7
"""calls the example_run method on all modules"""
from photoblaster.modules import Pb
for cls in Pb.__subclasses__():
    print cls.__name__
    instance = cls.example_run()
    instance.file_s3move()
    print instance.file_dict()
    instance.db_send();