AttributeError: 'NoneType' object has no attribute 'head'

Running scripts

2024-03-13 16:44:55,998 P[33204] [MainThread 648] Init a Desktop session with new app_key

2024-03-13 16:44:55,999 P[33204] [MainThread 648] entity: DataGrid_StandardAsync

2024-03-13 16:44:55,999 P[33204] [MainThread 648] payload: {'requests': [{'instruments': ['0#.SPX'], 'fields': [{'name': 'TR.CommonName'}, {'name': 'TR.IssuerRating(IssuerRatingSrc=SPI)'}, {'name': 'TR.IssuerRating(IssuerRatingSrc=SPI,Sdate=-10Y)'}]}]}

2024-03-13 16:44:56,000 P[33204] [MainThread 648] Request:{'Entity': {'E': 'DataGrid_StandardAsync', 'W': {'requests': [{'instruments': ['0#.SPX'], 'fields': [{'name': 'TR.CommonName'}, {'name': 'TR.IssuerRating(IssuerRatingSrc=SPI)'}, {'name': 'TR.IssuerRating(IssuerRatingSrc=SPI,Sdate=-10Y)'}]}]} } }

2024-03-13 16:44:56,000 P[33204] [MainThread 648] Request to http://127.0.0.1:9060/api/v1/data

headers = {'Content-Type': 'application/json', 'x-tr-applicationid': 'a8366afe8718413e8ddcdf5208ecfa49a4e65d37', 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBcGlWZXJzaW9uIjoiMSIsIkFwcEtleSI6ImE4MzY2YWZlODcxODQxM2U4ZGRjZGY1MjA4ZWNmYTQ5YTRlNjVkMzciLCJBcHBTY29wZSI6InRyYXBpIiwiTGlicmFyeU5hbWUiOiJSRFAgUHl0aG9uIExpYnJhcnkiLCJMaWJyYXJ5VmVyc2lvbiI6IjEuMS4xOCIsImlhdCI6MTcxMDM0NDY5NSwiZXhwIjoxNzExNTU0Mjk1fQ.vMShAhHAw8BV090ZnveaTlL83WtoVmC3undu73wipIA'}

params = None

2024-03-13 16:44:56,300 P[33204] [MainThread 648] Send request with headers [(b'Host', b'127.0.0.1:9060'), (b'Accept-Encoding', b'gzip, deflate'), (b'Connection', b'keep-alive'), (b'User-Agent', b'python-httpx/0.24.1'), (b'Accept', b'application/json'), (b'Content-Type', b'application/json'), (b'x-tr-applicationid', b'a8366afe8718413e8ddcdf5208ecfa49a4e65d37'), (b'Authorization', b'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBcGlWZXJzaW9uIjoiMSIsIkFwcEtleSI6ImE4MzY2YWZlODcxODQxM2U4ZGRjZGY1MjA4ZWNmYTQ5YTRlNjVkMzciLCJBcHBTY29wZSI6InRyYXBpIiwiTGlicmFyeU5hbWUiOiJSRFAgUHl0aG9uIExpYnJhcnkiLCJMaWJyYXJ5VmVyc2lvbiI6IjEuMS4xOCIsImlhdCI6MTcxMDM0NDY5NSwiZXhwIjoxNzExNTU0Mjk1fQ.vMShAhHAw8BV090ZnveaTlL83WtoVmC3undu73wipIA'), (b'Content-Length', b'243')] and cookies None

2024-03-13 16:44:56,301 P[33204] [MainThread 648] HTTP request response 200: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/html4/strict.dtd><html><head><title>Sign In</title><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/><meta http-equiv="content-type" content="text/html; charset=utf-8"/><META page=login><link rel="icon" type="image/vnd.microsoft.icon" href="/auth/images/favicon.png"/><link rel="shortcut icon" href="/auth/images/favicon.png"/><link rel="stylesheet" type="text/css" href="/auth/css/charcoal_commonstyles_spr.css?v=_2.5.2392.01"/><link rel="stylesheet" type="text/css" href="/auth/css/refinitiv_charcoal_loginstyles_spr.css?v=_2.5.2392.01"/><script type="text/javascript" src="/auth/js/signin_spr.js?v=_2.5.2392.01"></script><script type="text/javascript" src="/js/as.js?v=_2.5.2392.01"></script><script src="/auth/js/jquery-1.10.1.min.js"></script><script src="/auth/js/jquery-as.js?v=_2.5.2392.01"></script><script type='text/javascript'>function openHelpLink(){var …


But getting


Traceback (most recent call last):

File "test_ratings_data.py", line 13, in <module>

ratings_data.head()

AttributeError: 'NoneType' object has no attribute 'head'

Answers

  • @arbie.tapel

    Thank you for reaching out to us.

    From the log, the API got the 200 HTTP response that contains HTML.

    2024-03-13 16:44:56,301 P[33204] [MainThread 648] HTTP request response 200: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/html4/strict.dtd><html><head><title>Sign In</title><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/><meta http-equiv="content-type" content="text/html; charset=utf-8"/><META page=login><link rel="icon" type="image/vnd.microsoft.icon" href="/auth/images/favicon.png"/><link rel="shortcut icon" href="/auth/images/favicon.png"/><link rel="stylesheet" type="text/css" href="/auth/css/charcoal_commonstyles_spr.css?v=_2.5.2392.01"/><link rel="stylesheet" type="text/css" href="/auth/css/refinitiv_charcoal_loginstyles_spr.css?v=_2.5.2392.01"/><script type="text/javascript" src="/auth/js/signin_spr.js?v=_2.5.2392.01"></script><script type="text/javascript" src="/js/as.js?v=_2.5.2392.01"></script><script src="/auth/js/jquery-1.10.1.min.js"></script><script src="/auth/js/jquery-as.js?v=_2.5.2392.01"></script><script type='text/javascript'>function openHelpLink(){var …

    The title of the HTML is Sign In.

    The cause of this issue could be the account may be used on another machine, as mentioned on this disussion. Please make sure that the account is not used on another machine.