import os from psycopg2.extensions import AsIs from skygear.container import SkygearContainer from skygear.models import RecordID, Reference from skygear.options import options from skygear.utils import db from .exc import SkygearChatException container = SkygearContainer() opts = vars(options) container.api_key = os.getenv('API_KEY', opts.get('apikey')) container.app_name = os.getenv('APP_NAME', opts.get('appname')) schema_name = "app_%s" % container.app_name MASTER_KEY = os.getenv('MASTER_KEY', opts.get('masterkey')) def _get_conversation(conversation_id): # conversation_id can be Reference, recordID or string if isinstance(conversation_id, Reference): conversation_id = conversation_id.recordID.key if isinstance(conversation_id, RecordID): conversation_id = conversation_id.key data = { 'database_id': '_public', 'record_type': 'conversation', 'limit': 1, 'sort': [],
import os from psycopg2.extensions import AsIs import skygear from skygear.container import SkygearContainer from skygear.models import RecordID, Reference from skygear.options import options from skygear.utils import db from .exc import SkygearChatException container = SkygearContainer() opts = vars(options) container.api_key = os.getenv('API_KEY', opts.get('apikey')) container.app_name = os.getenv('APP_NAME', opts.get('appname')) schema_name = "app_%s" % container.app_name MASTER_KEY = os.getenv('MASTER_KEY', opts.get('masterkey')) def _get_conversation(conversation_id): # conversation_id can be Reference, recordID or string if isinstance(conversation_id, Reference): conversation_id = conversation_id.recordID.key if isinstance(conversation_id, RecordID): conversation_id = conversation_id.key data = { 'database_id': '_public', 'record_type': 'conversation', 'limit': 1,