HTTP Requests With Python's urllib.request (Overview)
If you need to perform HTTP requests using Python, then the widely used Requests library is often the way to go. However, if you prefer to use only standard-library Python and minimize dependencies, then you can turn to urllib.request
instead.
In this video course, you’ll:
- Learn the essentials of making basic HTTP requests with
urllib.request
- Explore the inner workings of an HTTP message and how
urllib.request
represents it - Grasp the concept of handling character encodings in HTTP messages
- Understand common hiccups when using
urllib.request
and learn how to resolve them
If you’re already familiar with HTTP requests such as GET and POST, then you’re well prepared for this video course. Additionally, you should have prior experience using Python to read and write files, ideally using a context manager.
In the end, you’ll discover that making HTTP requests doesn’t have to be a frustrating experience, despite its reputation. Many of the challenges people face in this process stem from the inherent complexity of the Internet. The good news is that the urllib.request
module can help demystify much of this complexity.
00:00
Welcome to Python’s urllib.request
for HTTP requests.
00:04
In this course, you’ll learn how to perform basic HTTP requests with urllib.request
, explore HTTP messages and their representation in urllib.request
, go from bytes to strings, go from bytes to file, and go from bytes to dictionary.
00:19
You may wonder why you’ll learn how to convert bytes to strings, files, or dictionaries in this course. I won’t tell you right now, but you’ll soon find out when you make your very first request with urllib
.
00:29
In the next lesson, the urllib.request
submodule will help you grab content from the Web right out of the box with Python without using any third-party packages.
00:39
Using urllib
is also great training to work with incoming data, in this case from the Web, and transforming it into a format to work with.
00:47
If you’re needing to make HTTP requests and want to stick to the standard library in Python, the urllib.request
submodule can help. To get the most out of this course, you’ll have heard of HTTP requests, including GET and POST.
00:58 You’ve also used Python to read and write to files using a context manager at least once.
01:03 Now that you know what’s going to be covered, let’s get started.
Become a Member to join the conversation.