Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- def CallAPI(data):
- try:
- client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- client.connect(('0.0.0.0', 9876))
- client.send(data)
- response = client.recv(4096)
- client.close()
- except Exception as e:
- print e
- finally:
- client.close()
- return response
- response = CallAPI("hello world")
- print response
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement