<s> try : <EOL> import config <EOL> except ImportError : <EOL> print ( "<STR_LIT>" ) ; exit ( ) ; <EOL> import sys <EOL> import socket <EOL> import ssl <EOL> import base64 <EOL> input = "<STR_LIT>" <EOL> input_base64 = ( base64 . b64encode ( input . encode ( '<STR_LIT:utf-8>' ) ) ) . decode ( '<STR_LIT:utf-8>' ) <EOL> credentials = config . credentials <EOL> credentials_base64 = ( base64 . b64encode ( credentials . encode ( '<STR_LIT:utf-8>' ) ) ) . decode ( '<STR_LIT:utf-8>' ) <EOL> post_payload = '<STR_LIT>' <EOL> post_payload = post_payload + config . message_type_downstream <EOL> post_payload = post_payload + '<STR_LIT>' + config . fieldname_downstream + '<STR_LIT>' <EOL> post_payload = post_payload + input_base64 <EOL> post_payload = post_payload + '<STR_LIT>' <EOL> s = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) <EOL> c = ssl . wrap_socket ( s ) <EOL> c . connect ( socket . getaddrinfo ( config . host , <NUM_LIT> ) [ <NUM_LIT:0> ] [ <NUM_LIT:4> ] ) <EOL> request = '<STR_LIT>' + config . device_id + '<STR_LIT>' <EOL> request = request + '<STR_LIT>' + config . host + '<STR_LIT:\r\n>' <EOL> request = request + '<STR_LIT>' <EOL> request = request + '<STR_LIT>' + credentials_base64 + '<STR_LIT:\r\n>' <EOL> request = request + '<STR_LIT>' + str ( len ( post_payload ) ) + '<STR_LIT>' <EOL> request = request + post_payload + '<STR_LIT>' <EOL> if ( sys . version_info . major == <NUM_LIT:3> ) : <EOL> c . write ( bytes ( request , '<STR_LIT:ascii>' ) ) <EOL> else : <EOL> c . write ( request ) <EOL> result = c . read ( <NUM_LIT> ) <EOL> print ( result ) <EOL> c . close ( ) </s>
