"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.)
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.)
