INNER CODE UNIT · Python
main
nordnet/next-api-v2-examples · python3/test_program.py:197
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()
private_key_path = sys.argv[3]
if country_code not in VALID_COUNTRIES:
raise Exception(f"COUNTRY_CODE parameter must be one of 'se', 'no', 'dk' or 'fi'.")
# Create an HTTPS connection
conn = http.client.HTTPSConnection(API_URL + country_code)
headers = {"Accept": "application/json"}
# Check Nordnet API status. Check Nordnet API documentation page to verify the path
print("Checking Nordnet API status...")