← Previous Next →

Doing HTTP requests

Created by Julien Palard

Description

Warning

You should work on this exercise with your own installation of Python, on you computer. Learn how for Mac OSX or Windows.

This is a short introduction to requests, a Python module that make grabbing content from the web quite easy.

Requests is NOT in the python distribution, but is installed along Anaconda.

If it's not installed, try: python3 -m pip install --user requests.

Now, your exercice will just have to GET the content of the page https://api.github.com/users/python, and print it.

In case your computer is not connected to the internet, your program should simply print No internet connectivity. on the standard output.

References

Example

$ python solution.py
{
  "login": "python",
  "id": 1525981,
  ...

Oh Damn ! The wifi is down !

$ python solution.py
No internet connectivity.

Your Code

Login to check your code and save your progress.

Results