Python 2.7 - Help using an API (HL7)
Posted
by
atomicluis
on Stack Overflow
See other posts from Stack Overflow
or by atomicluis
Published on 2012-09-30T21:33:26Z
Indexed on
2012/09/30
21:37 UTC
Read the original article
Hit count: 462
I am new to programming and Python.
I have a very basic python script that connects to server and send a text message:
#!/usr/bin/python
import socket
s = socket.socket()
host = '127.0.0.1'
port = 4106
s.connect((host, port))
message = 'test1'
s.send(message)
print s.recv(1024)
s.close
Everything is fine, except that this message is an HL7 message and needs to wrapped in MLLP I found this API that I think can do this for me (http://python-hl7.readthedocs.org/en/latest/api.html#mllp-network-client)
So I modified my program to the following, but I keep getting the error message: NameError: name 'MLLPClient' is not defined
#!/usr/bin/python
import socket
import hl7
host = '127.0.0.1'
port = 4106
with MLLPClient(host, port) as client:
client.send_message('test1')
print s.recv(1024)
s.close
Thanks in advanced for all the help
© Stack Overflow or respective owner