Beispiel #1
0
def main():
    with client_context(
            sc_thrift.SCService,
            '127.0.0.1',
            6000,
            proto_factory=TCyBinaryProtocolFactory(),
            trans_factory=TCyBufferedTransportFactory()) as context:
        client = Client(context)
        client.play()
def main():
    server = make_server(calc_thrift.Calculator,
                         Dispatcher(),
                         '127.0.0.1',
                         6000,
                         proto_factory=TCyBinaryProtocolFactory(),
                         trans_factory=TCyBufferedTransportFactory())
    print("serving...")
    server.serve()
Beispiel #3
0
def main():
    with client_context(calc_thrift.Calculator,
                        '127.0.0.1',
                        6000,
                        proto_factory=TCyBinaryProtocolFactory(),
                        trans_factory=TCyBufferedTransportFactory()) as cal:
        a = cal.mult(5, 2)
        b = cal.sub(7, 3)
        c = cal.sub(6, 4)
        d = cal.mult(b, 10)
        e = cal.add(a, d)
        f = cal.div(e, c)
        print(f)
Beispiel #4
0
    def fetch_all_works(self, uid):
        return json.dumps(kol.fetch_all_video(uid))

    def checkout_user_agent(self):
        return kol.checkout_user_agent()


if sys.platform == 'win32':
    kol_thrift = thriftpy.load(os.path.join(
        PRO_DIR, '.\\dolphin\\service\\douyin\\data\\kol_thrift.thrift'),
                               module_name='kol_thrift_thrift')
else:
    kol_thrift = thriftpy.load(os.path.join(
        PRO_DIR, './dolphin/service/douyin/data/kol_thrift.thrift'),
                               module_name='kol_thrift_thrift')

app = TProcessor(kol_thrift.KolServer, KolDispatcher())
# server = TProcessor(kol_thrift.KolServer, KolDispatcher())
#
if __name__ == '__main__':
    server = make_server(kol_thrift.KolServer,
                         KolDispatcher(),
                         '0.0.0.0',
                         6000,
                         proto_factory=TCyBinaryProtocolFactory(),
                         trans_factory=TCyBufferedTransportFactory())
    server.serve()

    # gunicorn_thrift dolphin.service.douyin.kolserver:app -k thriftpy_sync -b 0.0.0.0:6000 -w 4 --thrift-protocol-factory thriftpy.protocol:TCyBinaryProtocolFactory --thrift-transport-factory thriftpy.transport:TCyBufferedTransportFactory --thrift-client-timeout=5
    # gunicorn_thrift dolphin.service.douyin.kolserver:app --bind 0.0.0.0:7000 -w 10 -k thriftpy_gevent  --timeout 10  --thrift-protocol-factory thriftpy2.protocol:TCyBinaryProtocolFactory --thrift-transport-factory thriftpy2.transport:TCyBufferedTransportFactory --error-logfile aa.log -D -p douyin_server.pid
Beispiel #5
0
 def get_transport_factory(self):
     from thriftpy2.transport import TCyBufferedTransportFactory
     return TCyBufferedTransportFactory().get_transport
        try:
            sig, dytk, ua = kol.get_sig_dytk(uid, dytk=dytk, tac=tac)
            r = {
                'sig': sig,
                'dytk': dytk,
                'ua': ua
            }
        except BaseException as e:
            import traceback
            traceback.print_exc()
            return json.dumps({'msg': str(e)})
        return json.dumps(r)

    def checkout_user_agent(self):
        return kol.checkout_user_agent()


if sys.platform == 'win32':
    kol_thrift = thriftpy.load(os.path.join(PRO_DIR, '.\\dolphin\\service\\douyin\\data\\kol_thrift.thrift'), module_name='kol_thrift_thrift')
else:
    kol_thrift = thriftpy.load(os.path.join(PRO_DIR, './dolphin/service/douyin/data/kol_thrift.thrift'), module_name='kol_thrift_thrift')

app = TProcessor(kol_thrift.KolServer, KolDispatcher())
# server = TProcessor(kol_thrift.KolServer, KolDispatcher())
#
if __name__ == '__main__':
    server = make_server(kol_thrift.KolServer, KolDispatcher(), '0.0.0.0', 7000, proto_factory=TCyBinaryProtocolFactory(), trans_factory=TCyBufferedTransportFactory())
    server.serve()

    # gunicorn_thrift dolphin.service.douyin.kolserver:app -k thriftpy_sync -b 0.0.0.0:6000 -w 4 --thrift-protocol-factory thriftpy.protocol:TCyBinaryProtocolFactory --thrift-transport-factory thriftpy.transport:TCyBufferedTransportFactory --thrift-client-timeout=5
    # gunicorn_thrift dolphin.service.douyin.kolserver:app --bind 0.0.0.0:7000 -w 10 -k thriftpy_gevent  --timeout 10  --thrift-protocol-factory thriftpy2.protocol:TCyBinaryProtocolFactory --thrift-transport-factory thriftpy2.transport:TCyBufferedTransportFactory --error-logfile aa.log -D -p douyin_server.pid