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

Kinjal Mehta
Kinjal Mehta
6,986 Points

res.text gives me some doctype html code and not the random user data.

While trying to read the api text it shows some doctype html code instead of random user data.

1 Answer

Rachel KTY Johnson
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Rachel KTY Johnson
Treehouse Project Reviewer

Hey Kinjal Mehta !

I've just given it a go with https://randomuser.me/api and it's returning data in the form of a dictionary. Are you sure you're using that URL and not something like https://randomuser.me? If we're querying an endpoint that doesn't return data, then can return html code!