The code below used to work perfectly, now it is returing a 401 error. Any help would be appreciated. Note the API key has not expired.
import requests
import json
import csv
import re
# def get_lookup_info(ticker, access_token):
lookup_url = 'https://permid.org/';
headers = {
'Accept':'application/ld+json'
}
access_token = "FqL8ome1GAvAPv6NQ0lRQ1fNLYbLFipW"
ticker = "1-21548755953"
response = requests.get(url=f'{lookup_url}{ticker}?format=json-ld&access-token={access_token}', headers =headers )
response
Edit: I have even tried the official software using many other keys from our department, all end up in errors. Error is first code block, and execution code third code block.
ERROR:openpermid:<Response [401]>, {'Date': 'Wed, 18 Jan 2023 19:33:16 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '52', 'Connection': 'keep-alive', 'X-Cnection': 'close', 'Access-Control-Allow-Credentials': 'true', 'Vary': 'Origin', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 d7790c7504b110faa52e9641bf06a578.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'DFW56-P3', 'X-Amz-Cf-Id': 'tAP9Yj_NCHREsP1eBikoXjX_AZ5IDAAtClX1eQR6sa7K0XQRgkYyjw==', 'CF-Cache-Status': 'DYNAMIC', 'Server': 'cloudflare', 'CF-RAY': '78b9c2e56b0d29b4-ORD'}, {
"message":"Invalid authentication credentials"
}
(None, 'Unauthorized: {\n "message":"Invalid authentication credentials"\n}')
from OpenPermID import OpenPermID
opid = OpenPermID()
opid.set_access_token("FqL8ome1GAvAPv6NQ0lRQ1fNLYbLFipW")
opid.lookup("1-5064690523", format='dataframe', orient='row')