Best way to http python get json data? Need help with requests! or How to http python get json data e

22 Replies, 974 Views

"Struggling to http python get json data – any working examples?"

Hey folks,

I’ve been trying to http python get json data from an API, but keep hitting snags. Using the `requests` lib, but my code either times out or returns gibberish.

Here’s what I’ve got:
```python
import requests
response = requests.get('https://api.example.com/data')
print(response.json())
```
Sometimes it works, sometimes it doesn’t. Am I missing headers or something?

Also, is there a *better* way to http python get json data without pulling my hair out? Any tips or working examples would be clutch.

Thanks in advance!

(PS: If you’ve got a super simple method, I’m all ears.)

Messages In This Thread
Best way to http python get json data? Need help with requests! or How to http python get json data e - by - 20-08-2024, 12:18 AM



Users browsing this thread: 1 Guest(s)