Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Accessing an API with Python

Nicole Buckenwolf
Nicole Buckenwolf
8,718 Points

typo in video leading to a question

I was following the video exactly and at first couldn't figure out why my code wasn't working, so first please note there is no e between random and user in the api address - correct code is

requests.get("https://randomuser.me/api/")

But I also have a question about this, because I got a big old error, and the instructor's code appears to work, so I'm curious if anyone can explain why in the video they get Response [200] with the misspelled API?

1 Answer

Steven Parker
Steven Parker
229,920 Points

It just so happens that the domain with the misspelled name does actually exist, and will return a response regardless of any additional tree information added to the request.

:warning: Warning: Browsing this domain is not recommended, as it appears to belong to a domain squatter that is also using a "virus alert" phishing scam.   😱