I am trying to do a very simple service to collect and print data from a RESTfull API, in Python.
This is the code I have:
response = requests.get("url")
data2 = response.json()
PyCharm's inability to display the methods you mention indicate inability to infer the variable's type from the code alone. Which often indicates that the code might not be prepared to handle that variable's data properly in all cases (in many cases that means buggy code).
The fact that your code prints the type as
dict in that particular execution doesn't mean it'll always be a
dict (otherwise PyCharm would have been able to infer the type).
Making the code better prepared to deal with the variable's data in any situation - will make the type inferable, which will also allow PyCharm to fill in the data correctly.
For example, you could write your code like this:
response = requests.get("url") data2 = response.json() assert isinstance(data2, dict) print type(data2) # here data2's methods would be listed
response = requests.get("url") data2 = response.json() if isinstance(data2, dict): print type(data2) # here data2's methods would be listed