示例#1
0
 def __save_photo(self):
     if os.environ.get("MONGODB_URI") is None:
         db_controller = DBController()
     else:
         db_controller = DBController(uri=os.environ.get("MONGODB_URI"))
         db_controller.set_dbname(os.environ.get("DATABASE"))
     db_controller.connect()
     handle = HandlePhotoUpload(db_controller.get_database())
     return handle.put(self.get_photo())
示例#2
0
 def __get_photo_stream(self):
     if os.environ.get("MONGODB_URI") is None:
         db_controller = DBController()
     else:
         db_controller = DBController(uri=os.environ.get("MONGODB_URI"))
         db_controller.set_dbname(os.environ.get("DATABASE"))
     db_controller.connect()
     handle = HandlePhotoUpload(db_controller.get_database())
     file_id = self.get({
         "username": self.get_username(),
         "password": self.get_password()
     })[0]["photo"]
     return handle.write_on_file(file_id)