USER_AGENT_DUMMY = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36"
HEADERS = {"User-Agent": USER_AGENT_DUMMY}
r = requests.get("https://hogehoge.com/fuga.json", headers=HEADERS)
print(r.json())
# {'hoge': 'fuga'}
More than 1 year has passed since last update.
Python: インターネットからjsonを取ってきてDictにする
Last updated at Posted at 2022-02-09
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme