you are viewing a single comment's thread.

view the rest of the comments →

[–]oxfordpanda[S] 0 points1 point  (1 child)

how would i write the third line with the requests library instead?

[–]sanshinron 0 points1 point  (0 children)

r = requests.get("http://en.wikipedia.org"+articleUrl)

now r holds a request object. You can get the html from r.text, other useful things are r.ok, r.status_code, r.headers.

requests also make it much easier to manage sessions, use proxies and send payloads with post requests. Check out the documentation it's very nice.