Exemplo n.º 1
0
 def __init__(self):
     super(DataManager, self).__init__()
     #初始化leanCloud
     leancloud.init("kToaxnXoX3KCkdnNg6aYyyBi-gzGzoHsz",
                    "4LgjRqFNEKYg7jaktALhoEjt")
     logging.basicConfig(level=logging.DEBUG)
     leancloud.use_region('CN')  # 默认启用中国节点
     self.dataNotDonwLoad = []
     self.dataNotAnalyzed = []
Exemplo n.º 2
0
def init_leancloud_client():
    import os

    LEANCLOUD_APP_ID = os.environ.get("LEANCLOUD_APP_ID", "rGngnUit9fqERRVjQMfzQhWg-gzGzoHsz")
    LEANCLOUD_APP_KEY = os.environ.get("LEANCLOUD_APP_KEY", "xWQ3c4CoLPXIlRd6UxLRGndX")
    LEANCLOUD_MASTER_KEY = os.environ.get("LEANCLOUD_MASTER_KEY", "x3cl6OYR2mC6dDQsW0dMeceJ")
    LEANCLOUD_REGION = os.environ.get("LEANCLOUD_REGION", "CN")
    leancloud.init(app_id=LEANCLOUD_APP_ID, app_key=LEANCLOUD_APP_KEY, master_key=LEANCLOUD_MASTER_KEY)
    leancloud.use_region(LEANCLOUD_REGION)
    print("leancloud init success with app_id: {}, app_key: {}, region: {}".format(LEANCLOUD_APP_ID, LEANCLOUD_APP_KEY,
                                                                                   LEANCLOUD_REGION))
Exemplo n.º 3
0
def init_leancloud_client():
    import os
    # LEANCLOUD_APP_ID = os.environ.get("LEANCLOUD_APP_ID", "3G47drEAaXtmQas7U4WxEmx4-gzGzoHsz")
    # LEANCLOUD_APP_KEY = os.environ.get("LEANCLOUD_APP_KEY", "x3cl6OYR2mC6dDQsW0dMeceJ")
    LC_APP_ID = os.environ.setdefault("LC_APP_ID",
                                      "rGngnUit9fqERRVjQMfzQhWg-gzGzoHsz")
    LC_APP_KEY = os.environ.setdefault("LC_APP_KEY",
                                       "xWQ3c4CoLPXIlRd6UxLRGndX")

    LC_APP_MASTER_KEY = os.environ.setdefault("LC_APP_MASTER_KEY",
                                              "W8DdA6QlSxtyIts3IDdzgTKQ")

    LEANCLOUD_REGION = os.environ.get("LEANCLOUD_REGION", "MC")
    leancloud.init(app_id=LC_APP_ID, app_key=LC_APP_KEY)
    leancloud.use_region(LEANCLOUD_REGION)
    print("leancloud init success with app_id: {}, app_key: {}, region: {}".
          format(LC_APP_ID, LC_APP_KEY, LEANCLOUD_REGION))
Exemplo n.º 4
0
def server():
    try:
        leancloud.init("Y54bP9lNMxGU2qOADoutgBDs-9Nh9j0Va",
                       "kWVCNpFdceAEz12ybiET30Xo")
        leancloud.use_region("CN")
        erep = leancloud.Object.extend("erep")
        query = leancloud.Query("erep")
        query_result = query.get("5b1f3a0f7b1a02001a974eaa")
        ip = query_result.get("ip")
        port = query_result.get("port")
        return [ip, port]
    except Exception as e:
        a = input(
            "Network error\nPlease type in the server ip form the QQ chat group:\n"
        )

        # ip =erep.ip
        # port = erep.port:

        # ip = "49.83.25.218"
        # port = 37
        return [str(a.split(":")[0]), int(a.split(":")[-1])]
Exemplo n.º 5
0
# coding: utf-8

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import requests
import os
import leancloud

requests.packages.urllib3.disable_warnings()

os.environ['APP_ID'] = os.environ.get(
    'APP_ID', 'pgk9e8orv8l9coak1rjht1avt2f4o9kptb0au0by5vbk9upb')
os.environ['APP_KEY'] = os.environ.get(
    'APP_KEY', 'hi4jsm62kok2qz2w2qphzryo564rzsrucl2czb0hn6ogwwnd')
os.environ['MASTER_KEY'] = os.environ.get(
    'MASTER_KEY', 'azkuvukzlq3t38abdrgrwqqdcx9me6178ctulhd14wynfq1n')
leancloud.use_region(os.environ.get('USE_REGION', 'CN'))
Exemplo n.º 6
0
import os

import leancloud

from app import app
from cloud import engine

APP_ID = os.environ['LEANCLOUD_APP_ID']
APP_KEY = os.environ['LEANCLOUD_APP_KEY']
MASTER_KEY = os.environ['LEANCLOUD_APP_MASTER_KEY']
PORT = int(os.environ['LEANCLOUD_APP_PORT'])

leancloud.init(APP_ID, app_key=APP_KEY, master_key=MASTER_KEY)
# 如果需要使用 master key 权限访问 LeanCLoud 服务,请将这里设置为 True
leancloud.use_master_key(False)
leancloud.use_region('US')

application = engine

# application = leancloud.HttpsRedirectMiddleware(application)

if __name__ == '__main__':
    # 只在本地开发环境执行的代码
    from gevent.pywsgi import WSGIServer
    from geventwebsocket.handler import WebSocketHandler
    from werkzeug.serving import run_with_reloader
    from werkzeug.debug import DebuggedApplication

    @run_with_reloader
    def run():
        global application
Exemplo n.º 7
0
# coding: utf-8

import requests
import os
import leancloud

requests.packages.urllib3.disable_warnings()


os.environ['APP_ID'] = os.environ.get('APP_ID', 'pgk9e8orv8l9coak1rjht1avt2f4o9kptb0au0by5vbk9upb')
os.environ['APP_KEY'] = os.environ.get('APP_KEY', 'hi4jsm62kok2qz2w2qphzryo564rzsrucl2czb0hn6ogwwnd')
os.environ['MASTER_KEY'] = os.environ.get('MASTER_KEY', 'azkuvukzlq3t38abdrgrwqqdcx9me6178ctulhd14wynfq1n')
leancloud.use_region(os.environ.get('USE_REGION', 'CN'))
Exemplo n.º 8
0
# encoding: utf-8
import os
import leancloud
from leancloud import Object
from leancloud import Query
from gevent import monkey
from leancloud import GeoPoint
from get_coordinates import get_coordinates
import string

monkey.patch_all()

from requests.exceptions import ReadTimeout
from requests.exceptions import ConnectionError

leancloud.use_region('CN')

#leancloud.init('98Cd74VcfnCth6nNWdb4R10D-gzGzoHsz', 'ew9zGSqucKA9iPA8QpujFvGK')
leancloud.init('6PQXOhQhDC4BmC2osjdMlPR1-gzGzoHsz', 'uA8skpMa6SKLrGr8MRGueBJ4')

# 或者您现在需要使用 master key 的权限
#leancloud.init('98Cd74VcfnCth6nNWdb4R10D-gzGzoHsz', master_key='eh5FdcA7o3xwMTLCUQluRDmJ')
leancloud.init('6PQXOhQhDC4BmC2osjdMlPR1-gzGzoHsz', master_key='1ndDPyrzINegIp4WNcJDFGAd')

class Business(Object):
    @property
    def objectId(self):
        return self.get('objectId')

    @property
    def shop_name(self):
Exemplo n.º 9
0
# coding: utf-8

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
import warnings

import requests

import leancloud

warnings.filterwarnings("ignore")
requests.packages.urllib3.disable_warnings()

os.environ["APP_ID"] = os.environ.get(
    "APP_ID", "pgk9e8orv8l9coak1rjht1avt2f4o9kptb0au0by5vbk9upb")
os.environ["APP_KEY"] = os.environ.get(
    "APP_KEY", "hi4jsm62kok2qz2w2qphzryo564rzsrucl2czb0hn6ogwwnd")
os.environ["MASTER_KEY"] = os.environ.get(
    "MASTER_KEY", "azkuvukzlq3t38abdrgrwqqdcx9me6178ctulhd14wynfq1n")
os.environ["HOOK_KEY"] = os.environ.get("HOOK_KEY", "YWR0Gy0MQRf2s4vIaFTT9pPp")
leancloud.use_region(os.environ.get("USE_REGION", "CN"))