Get A Web Page And Pull It Into A Variable In Python
Pull JSON from a url into a python variable with `requests``
Code
=
=
=
=
=
=
Results
{
"avatar_url": "https://avatars.githubusercontent.com/u/845049?v=4",
"bio": "I like making things and taking notes. In fact, I spend a lot of time making things _to_ take notes",
"blog": "https://www.alanwsmith.com/",
"company": "alanwsmith.com",
"created_at": "2011-06-12T11:08:56Z",
"email": null,
"events_url": "https://api.github.com/users/alanwsmith/events{/privacy}",
"followers": 41,
"followers_url": "https://api.github.com/users/alanwsmith/followers",
"following": 45,
"following_url": "https://api.github.com/users/alanwsmith/following{/other_user}",
"gists_url": "https://api.github.com/users/alanwsmith/gists{/gist_id}",
"gravatar_id": "",
"hireable": null,
"html_url": "https://github.com/alanwsmith",
"id": 845049,
"location": "the u.s.",
"login": "alanwsmith",
"name": "Alan Smith",
"node_id": "MDQ6VXNlcjg0NTA0OQ==",
"organizations_url": "https://api.github.com/users/alanwsmith/orgs",
"public_gists": 16,
"public_repos": 304,
"received_events_url": "https://api.github.com/users/alanwsmith/received_events",
"repos_url": "https://api.github.com/users/alanwsmith/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/alanwsmith/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/alanwsmith/subscriptions",
"twitter_username": null,
"type": "User",
"updated_at": "2023-10-22T18:25:07Z",
"url": "https://api.github.com/users/alanwsmith"
}
Pull the page directly as text
Code
#!/usr/bin/env python
=
=
=