REST SESSION.GET not working

1 post / 0 new
kiann00
REST SESSION.GET not working

Hi there, I am trying to learn how to use python to connect to IG data. I use the following information from the REST page in IG labs. However, I don't seem to be able to extract me session details for confirmation.

The REST sessions.get code doesn't seem to be working

import requests
import json

url = 'https://demo-api.ig.com/gateway/deal'
s = requests.Session()
s.headers = { 'Content-Type' : 'application/json; charset=UTF-8',
'Accept' : 'application/json; charset=UTF-8',
'VERSION' : '2',
'X-IG-API-KEY' : 'XXXXX'
}
data = { 'identifier' : 'XXXX',
'password' : 'XXXXX'
}

r = s.post(url + '/session', json=data)
r = s.get(url + '/session')
r

Would any experts be able to kindly help?