In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Original articles, welcome to reprint. Reprint please indicate: reproduced from IT Story Association, thank you!
Original link address: "Advanced articles" Python Development Information Service of docker (11)
The information service is ready to be written in python, adding python modules to the existing idea. Source code: https://github.com/limingios/msA-docker
Idea installs the python plug-in
Re-idea after installation.
Install the python module
Install the pyhon plug-in for thrift
At first, I used idea to write python, and it was hard to download a plug-in. I replaced it with pycharm to write about Meizi.
Edit Python's service code # coding: utf-8from message.api import MessageServicefrom thrift.transport import TSocketfrom thrift.transport import TTransportfrom thrift.protocol import TBinaryProtocolfrom thrift.server import TServerclass MessageServiceHandler: def sendMobileMessage (self, mobile, message): print ("sendMobileMessage, mobile:" + mobile+ ", message:" + message) return True def sendEmailMessage (self, email, message): print ("sendEmailMessage, email:" + email+ " Message: "+ message) return Trueif _ _ name__ ='_ _ main__': handler = MessageServiceHandler () processor = MessageService.Processor (handler) transport = TSocket.TServerSocket (None," 9090 ") tfactory = TTransport.TFramedTransportFactory () pfactory = TBinaryProtocol.TBinaryProtocolFactory () server = TServer.TSimpleServer (processor, transport, tfactory, pfactory) print (" python thrift server start ") server.serve () print (" python thrift server exit ")
Check that the port has been started
Generate commands corresponding to java and python
The corresponding superior directory is generated according to the thrift file.
Thrift-- gen py-out.. / message.thriftthrift-- gen java-out.. / message.thrift
The development process of PS:thrift is to define the file of thrift first, and then generate the corresponding python code by command. The call to thrift is completed by implementing the defined thrift method.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.