 Hey, what's going on everybody? My name is John Hammond and welcome back to another Python programming tutorial. So in this video, in this series, we've been checking out the URL lib module, and now we're moving into the utility functions that this module has for us. So the first thing that we're going to take a look at is the quote function, and that takes one argument string and an optional parameter safe. So what this does is it replaces the special characters in string, the variable that we passed through it, using percent sign encoded escape sequences. So letters, digits and characters are never quoted, but by default, the function is intended for quoting the path section of a URL. The safe parameter includes characters that are not going to be quoted. And by default, the value is just a forward slash. So the documentation gives a little example here. And let's just demonstrate that really easily. It's interesting, because this stuff, all these quote functions and all these utility functions, I want to do actually in the next tutorial, write them on our own, like we can build them ourselves. But for now, I just want to demonstrate them, because you can see here, that's been encoded with this percent sign, seven e as the encoded character for this tilde. And remember that optional safe argument is by default, a forward slash. And that's why these forward slashes haven't been changed. Like the results and the return value is the exact same. And both these two function calls, the moment we change this to something without it, though, these forward slashes are going to be encoded as well. So there's another function in here, quote, plus, that does the exact same thing. However, all of the strings that are used, all the spaces inside the strings are going to be converted to a plus sign. Oh, sorry, in regular quote, they're not they're just converted to the percent 20, the percent encoded version of that, in quote, plus, keep in mind, those spaces become plus signs. But you'll notice a difference here is that these forward slashes, while using quote, the safe keyword is again, defaulting to this forward slash. And that's why these forward slashes are retaining their value. But in quote, plus, they've changed to the percent encoded sign. Why is that? Well, note here, quote, plus does not have a safe default to the forward slash. Huh. Okay, moving on, we'll take a look at the next one, unquote, and unquote, plus, these are again, friends of quote, unquote, plus, but they just do the reverse. If I were to run unquote, plus, with the string that we were just returned with our original, it would convert it back to the original. And you can do the same thing. Specifying whether or not we're using plus signs or not. In that case, it will retain it. But if it were the percent 20, they convert it back to a space. Okay, next is URL encode. This one's interesting, because it takes any mapping objects or even a sequence of two element tuples, and it converts them to a percent encoded string, just like our quote functions do. But it also gets them prepared and ready to be passed to a post request, if we were to send it through URL open or URL tree or anything like that. Typically, it's key value pairs that are separated by an ampersand. And you'll you see them a lot probably in get requests, if you've ever used a web browser and done stuff with web pages that use the get method. But again, both key and value are quoted using quote plus, just like we saw the demonstration of that function before. And yeah, so let's try let's take a look. I'm actually set up some data as a dictionary. And let's just say name equal john Hammond age and be 18. And okay, there's just some data for us, we can run URL lib URL encode on that data. And there it is key value pairs age equals 18 and name equals john plus Hammond because that plus is being quoted with quote plus, you'll notice if we actually add more to that data, let's say directory equals four slash home four slash directory. And if we run this directory is going to be encoded with quote plus. And since quote plus does not have a safe equals by default that forward slash there, these four slashes are going to be encoded. And that's why they're a percent 2f, you know. So that's really it. Path to name path name to URL and URL to path name, I'm not really in cover, get proxies. Again, I'm not going to show off too much about it. But it, it what it does is it scans your environment for variables that have a named like scheme proxy like HTTP proxy or ftp underscore proxy stuff like that. It's case insensitive. But if it doesn't find anything for Mac, it'll look for the system configuration and windows it looks in the registry. But in my case, it will return nothing because I have no environment variables set for proxies. So that's really it. That's really all I wanted to show you in the next tutorial actually build some of these on our own, at least quote, quote plus, unquote, unquote, and URL encode. The documentation has a note here. These utility functions, they're also more of them, but they're in the URL parse module. That's where you'll actually see more of this stuff. If you want to go through the documentation and read through it, you can totally do that. It looks like it breaks the URL up into nifty things. And it might be worthwhile to read and learn about. So cool. That's all I wanted to cover in this tutorial, quote, quote, plus, unquote, and etc, etc. So hopefully you'll use these alongside URL lib if you're ever passing data or need to modify some URL stuff. But I hope you guys enjoyed it. See you in the next tutorial.