Hello Everybody,

I searched the the internet and this forum, but cannot find the solution for my problem.
Started with python and have this code (part of):

import requests

`def Send_invitation():
  data = {"bsn": e3.get(), "initialen": e2.get(), "achternaam": e1.get(), "geslacht": e4.get(), "geboortedatum": e5.get(),
  "postcode": e6.get(), "emailadres": e7.get(), "screening_type": e8.get()}
  response = requests.post("http://dev.name.nl/api/orgo/3/something", headers=headers, json=data)
  j = response.json()
  print (j) 

This is the output:

  {'initiator': {'rol_label': 'Hoofdbehandelaar', 'id': 6, 'naam': 'Rem_SYS'}, 'behandelaar': {'rol_label': 'Hoofdbehandelaar', 'id': 6, 'naam': 'Rem_SYS'}, 'metadata': None, 'belangrijk': None, 'persoon': {'geslacht': 'M', 'email': 'justmymail@gmail.com', 'naam': 't try', 'initialen': 't', 'postcode': '1111', 'achternaam': 'try', 'tussenvoegsel': None, 'geboortedatum': '1976-11-11', 'bsn': '00000000'}, 'id': 'p1GOMdde21dQH0cP-_QQdeGdex5deK1iCKidedeLqCeduHx3I', 'screening_type': 'thuis', 'url': 'justsomeurl.com', 'status': 'uitgenodigd', 'time': '2016-03-09T18:11:31.918Z'}

I would like to select the 'id': 'p1GOMdde21dQH0cP-_QQdeGdex5deK1iCKidedeLqCeduHx3I'

So I do:

print (j(['id']))
    TypeError: 'dict' object is not callable

I searched the TypeError and tried some of the solutions, but can't get the result I wish for

saw an example

replace the ()'s in latitude = request.json('latitude') with []'s.
request.json object is a dictionary, not a function.

I did that and

id = requests.json['id']
TypeError: 'method' object is not subscriptable

So after many searches, may TypeErrors ..I am stuck
I'am using python 3.5

Hope somebody can help me with this

Thanks already
Rem

Try id = j['id'], and read a python tutorial!

Thanks..
I see the mistake I made.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.