Just like in the APIs and Databases course, you'll use the requests library to connect to an API and receive the responses.
Uzby Name Generator
For this walkthrough, you'll use the Uzby name generator API to create random names for your players. You'll work with this specific API because it's relatively straightforward and is very focused on doing just this one thing.
Uzby Documentation
Before you can start working with an API, you'll always need to read through its documentation to know how to interact with it. The Uzby API documentation is quite short and fits on one page:
Essentially, you'll make your request to the following URL, providing a number as a parameter for MINIMUM_LENGTH and MAXIMUM_LENGTH:
https://uzby.com/api.php?min=MINIMUM_LENGTH&max=MAXIMUM_LENGTH
If you wanted to create a random pronounceable name between a length of 4 and 8 characters, you can visit this URL in your web browser:
https://uzby.com/api.php?min=4&max=6
You'll see a very basic result in your web browser. It's just what you asked the API to get for you:
You can make the same request that you just made with your web browser with Python instead. You'll revisit how to do that in the next lesson.