question

Upvotes
Accepted
3 1 1 3

All data platform session queries return None (python)

Hello,

I started using the refinitiv platform session API earlier today and while I am able to start a session and validate that it's been opened, any requests I make - rdp.get_snapshot, etc - return Nonetype objects. I'm assuming there's an issue of some kind with my configuration but I'm unclear as to what kind of error it is since the session appears to open fine. I am using refinitiv-dataplatform 1.0.0-alpha.9 with python 3.9.5.

Sample code:

session = rdp.open_platform_session(

app_key,

rdp.GrantPassword(

mach_id,

mach_pw

)

)

x = rdp.get_snapshot(

universe = ['GBP=','JPY='],

fields = ['BID','ASK']

)

print(x)

rdp.close_session()


Outputs

None

UserWarning: Unclosed <httpx.AsyncClient object at 0x7fe7108dc6a0>. See https://www.python-httpx.org/async/#opening-and-closing-clients for details.

Any help would be appreciated!

rdp-apirefinitiv-data-platform
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @carter.alexander ,

Thank you for your participation in the forum.

Is one of the replies below satisfactory in resolving your query?

If yes, please click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

-AHS

Upvotes
Accepted
25.3k 87 12 25

Hi @carter.alexander

The fact you see the above insufficient scope message confirms you have a valid machineID and password and that you are authenticating correctly.

The issue is that you are not licenced for whichever data you are trying to request.

I have emailed you directly so I can check your credentials.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25.3k 87 12 25

Hi @carter.mccullum

Please add the following line to help understand why you are receiving no data back.

print(x)
print(rdp.get_last_status())
rdp.close_session()

The usual reason is that you are not licenced for the instruments you are requesting e.g. trial account.

you can also try requesting the delayed versions of the same RIC i.e.

universe = ['/GBP=','/JPY='],

If you are licenced for streaming data but not for fee-liable data (e.g. a trial account), then you should be able to get the above RICs.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25.3k 87 12 25

Hi @carter.mccullum

You can also try the following - which uses the RDP Snapshot API - whereas the code above is using the Streaming interface to request a snapshot.

universe = ['EUR='] 
fields = ['ASK', 'BID']
response = rdp.Pricing.get_snapshot(universe, fields)
print(response.data.df)
print(response.status)

If you are not permissioned for either of the above, then you will need to contact your Refinitiv account representative to discuss your licence requirements.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Both this and the above option return the output {'http_status_code': 403, 'http_reason': 'Forbidden', 'error': {'id': '4d2b3603-221d-441b-b9f9-17873bfb1b5d', 'code': 'insufficient_scope', 'message': 'access denied. Scopes required to access the resource: [trapi.data.pricing.read]. Missing scopes: [trapi.data.pricing.read]', 'status': 'Forbidden'}}. I am using a trial account - would it be best to reach out to our account representative to ask about what apis we do have access to?

Upvotes
25.3k 87 12 25

Hi @carter.alexander

I am not part of the account/sales team - but I did try to check your email address and I don't see any Account Team contact against your details.

Did you actually receive a Welcome Email that contained a MachineID - which looks something like GE-A-xxxxxx-x-xxxx and a link to set a long password (30+ characters)?

If not, then all you may have is a basic My.Refinitiv login - which only allows access to the dev portal documentation, articles and tutorials.

If you want to discuss a free trial etc please use the Contact us | Refinitiv page and your query will be directed to the New Business Team.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi @umer.nalla - I am using a trial account assigned to our institution and we have received both a machine id and a machine password. I am able to generate OAuth2 tokens/establish a connection to the rdp platform using the machine id/password - I am just unable to actually query any data via that connection.
Upvotes
1 0 1 2

Hi @umer.nalla , I have similar issue.

Can you explain what this error means ?


x = rdp.get_snapshot(
universe = ['GBP=','JPY='],
fields = ['BID','ASK']
)
print(x)
print(rdp.get_last_status())
rdp.close_session()
None
{'http_status_code': -1, 'http_reason': b"[Errno 10061] Connect call failed ('127.0.0.1', 9060)"}

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25.3k 87 12 25

Hi @piotr.arendarski

Your error message looks quite different to the existing post - therefore, in that case, I would recommend starting a new post for a quick response. Old threads that have an accepted answer are not monitored by the moderators.

Your error message would suggest you are creating a Desktop session, but that the library cannot connect to the Eikon Data API proxy.

Do you have Eikon or Workspace open and running on the same physical PC where you are running the python script?

What response do you get to the following?

http://localhost:9000/ping?all

http://localhost:9060/ping?all

and also:

http://localhost:9060/api/

http://localhost:9000/api/


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 0 1 2
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 0 0 2

I had a similar situation recently while working on a microservice based chatbot application, Django for the admin and Flask for the main app. Whenever I update a model instance in the database, the queue should ideally print the instance to my console, instead it returns a None.


The consumer on the Main flask app

params = pika.URLParameters('some URL')

connection = pika.BlockingConnection(params)

channel = connection.channel()

channel.queue_declare(queue='main')

def callback(ch, method, properties, body):
    print('Recieved in main')
    data = json.loads(body)
    print(data)

    if properties.content_type == 'product_created':
        product = Product(id=data['id'], title=data['title'], image=data['image'])

        #  Create object with SQLAlchemy
        db.session.add(product)
        db.session.commit()
        print('Product Created')

    elif properties.content_type == 'product_updated':
        product = Product.query.get(data['id'])
        
        product.title = data['title']
        product.image = data['image']
        
        db.session.commit()
        print('Product Updated')
    
    elif properties.content_type == 'product_deleted':
        product = Product.query.get(data)

        db.session.delete(product)
        db.session.commit()
        print('Product Deleted')




channel.basic_consume(queue='main', on_message_callback=callback, auto_ack=True)

print('Started Consuming')

This issue returned no value and I don't know how to fix it. I have reached out to several chatbot development services provider but the exact outcome is not obtained.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.