Challenge #3: Initializing a Class

Franccesco Orozco edited this page Apr 26, 2018 · 5 revisions

Difficulty: :star::star:

Test: pipenv run python -m unittest tests/ -f


  • Import the package requests. Beware: It is more beneficial to load only the packages that you need, in this case you will need the method get from requests package.
  • Modify your IPInfo class inside and define your initialization module. This initialization will require only one parameter of type string and will be called ip.
  • Create a Class Attribute named ip_data. This class attribute will requests a json response from the public API where IP_NUMBER is equal to the initialization parameter ip. To challenge yourself, try to make this JSON request in a single line.

TL;DR: Define your class initialization that accepts only one parameter => Create a class attributes that makes a json requests to


You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.