INNER CODE UNIT · Python
receive_message_from_socket
nordnet/next-api-v2-examples · python3/test_program.py:186
def receive_message_from_socket(socket):
"""
Receive data from the socket and parse it
"""
print('\nStarting receiving from socket...\n')
buffer = ''
while True:
buffer = do_receive_from_socket(socket, buffer)
print('\nFinishing receiving from socket...\n')
def main():
# Input API key string (from uploading your public key on www.nordnet.se|dk|no|fi), country code (se|dk|no|fi) and path to your private key
if len(sys.argv) != 4:
raise Exception('To run test_program you need to provide as arguments [API_KEY] [COUNTRY_CODE] [PRIVATE_KEY_PATH]')
api_key = sys.argv[1]
country_code = sys.argv[2].lower()