Skip to content
TORNLIFE More

Python Api parsing Json problem

Started by PrecatorBaxter [3288988] on in API Development.

3 replies · 105 views · thread synced · 6 days ago · View on torn.com
About this thread

Posts archived: 4 / 4 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
4
Discussion span
→
People posting
3
Likes on archived posts
2
Authority score
50 / 100
Historical score
16 / 100
Story score
24 / 100
Engagement score
42 / 100
PrecatorBaxter [3288988]
I am using this endpoint > https://api.torn.com/torn/?selections=items&key=

I see all the items in the browser, but I am having problems.

response = requests.get("https://api.torn.com/torn/?selections=items&key=" + key)
json_data = json.dumps(response.text)


After this I am having a problem. I want to loop over each item and loop over the results and print the market_value variable. I know I am supposed to do like for x in json_data but it seems to get stuck on the top level items dict i believe. Sorry I am new to Python and just trying to figure this out.
pobk [3171827]
If you're using requests, you can use response.json()

That will return a python object you can iterate over.