我正在编写一个HTTP客户端。这是一个简单的模拟银行网站。它需要能够发出两种请求:
我正在通过扭曲的python实现它,我编写了HTTPClient的子类:
class BankClient(HTTPClient):
def genReq():
# How to write code to generate and send the Two request?
def connectionMode(self):
genReq()
class BankCllientFactory(ClientFactory):
protocol = BankClient
def __init__(self):
self.done = Defered()
def main(reactor):
factory= BankClientFactory()
reactor.connectTCP('localhost',8080,factory)
return factory.done
if __name__ =='__main__':
task.react(main)
答案 0 :(得分:0)