Posts

Showing posts with the label Python Error

Error Using Python Requests Library - TypeError: 'dict' object is not callable

A recent task at work was to generate a Python class that could be used by developers to interact with our API. One of the methods in that class was to do a curl call to our API. For this i used the very nice Requests Library  and since our API returns output in JSON, i used the: r.json()  function to return the output. This worked fine on my Mac, but when this was tested on a Windows machine it returned the following error: line 68, in doCurl    print r.json()  TypeError: 'dict' object is not callable The solution, or so I thought was to use:   r.json As documented in the Love Python blog article. This worked wonders for the Windows machine, but as a consequence, it made my Mac spit out the following: <bound method Response.json of <Response [200]>> Since Python is not one of my strongest languages, (I've only been learning it for a few days!) I have no solution as to why this is happening and how to fix it. In the end...