Make an HTTPS request instead of just HTTP

Fixes problems I found trying to follow the tutorial. Fixes #1.

- Does an HTTPS request instead of HTTP.
- Extracts all the request logic to a helper **do_request**