 Okay, how do you testing make sure this actually works is What's up everybody? My name is John Hammond and welcome back to another YouTube video tutorial And this thing I want to show off the Python module W get which is a small simple module But it acts as like a download utility for any URL or file you find online And you just want to do a nice little like HTTP get request download the file or the thing, you know So yeah, I've got it open up in Firefox right now just looking at the W get page in the pi pi Python package index repository and It's looks simple enough. We have a nice little example We can poke at and let's try and poke at it. I'm gonna fire up idle import W get and we get an error because it's not installed right now It's not installed by default so we can go ahead and stall it we get our terminal open and since it's part of the Python like Repository all the package index we can get it with PIP the Python package installer If for whatever reason you don't already have PIP you can install it with pseudo-app install Python dash PIP Mine is already installed. So we can just PIP install The syntax is just PIP install the name of the module W get it'll run through it and now if we fire up idle We should be able to run import W get and then it works just fine for us We don't get an error this time. Cool. So the demonstration that they give they do a little URL equals and Download with just this string of the URL. They stored in the variable. I guess I really have to do that I can just call download and pass it in and you'll notice our options here are URL out equals none Bar equals function bar adaptive. I don't know what that is yet. I mean, I know what that is Yeah, but I'm just saying that as the you know acting. I'm trying to act just All right It will pass in the URL. It's the only variable. It actually needs to work And then after a little bit downloads this file and hey, it returns apparently the file name of what is it? We're actually downloading razorback.mp3 if I hop over my terminal LS. I can see that it it's right there it did just download it and Yeah That's really it just lets you download stuff an interesting thing though Is it if I look over here on this this web page example they get this cutesy little? They get this little progress bar. I want one of those So because I did this in idle, it's not actually going to display that But if we were to do this in this shell far just get a python interpreter import W get little W get download passing that URL Hey, now we get that URL bar. That's kind of cool a little progress bar and it's okay just created a copy of That razorback download file we can play that out and just prove the fact that it's a real thing Yep, it's a song cool. All right notice though We got that little little progress bar Looks like when we ran W get that download it even displayed. Oh bar. That's a keyword Or we can probably change that we can probably actually specify but it also function bar adaptive at some hex address If we look at the help here Looks like okay that parameter out we can specify the output file name directory where we actually want to put the file that it saves to and Bar function can be a function to track its progress sort of visualize it So if we actually look at W get if we hit that control space to look more into what other function it offers us It looks like bar adaptive bars are modern These are other things that it's actually using as part of the module the library to display that out for us We weren't able to see it within idle, but within the shell We were able to and we can probably turn that off if we pass in like a bar equals none or something to So we don't have that if we don't want it What else is there we get file name from URL? File name fix existing Looks like detect file name it looks like if we pass in the URL It'll just give us the file name that it would have gotten without actually downloading the thing and it looks like it splits that up by See I see URL parse in here you hold up parse and that's a module so you rolled up parse looks like it has URL parse URL split etc So if we give it that URL to work with it looks like it just actually I Made a boo boo my bad There we go. It looks like it will split up How it should Some cool way for whatever reason you want to dig into this and kind of dissect a module see how it works Looks like math and OS and sh util insists other oh even temp file. We might be able to store this in a temp file And other ways that it works looks like usage is an interesting thing That's the string that we'd be able to see how do we ran or how do we invoked w get? Through a through a module. So if we ran Python dash m w get we'll get this string And if we give it that URL it'll download everything the same way it's done before now It's just invoking it as a module like a command through Python. That's all Still cool stuff a little dash dash version Some other arguments. Yeah All right another interesting thing that I saw was w get dot Get console width that looks like a function and obviously an idol It's gonna return zero because there's no there's no console that it's actually working with But if we were to run this from the shell It'll it'll like actually seriously figure out our console width, which is actually kind of cool Saves you from breaking out of the whole like end curses or Terminal mode thing, but it looks like it's 71 characters wide I'm sure it probably needs that for like that progress bar thing that it builds But if anything that's a cool function to know you can just quickly whip out and grab the console with All it takes is this w get module It's pretty much it that's all I wanted to show you really cool thing simple Really just mocks the w yet or it's supposed to build off the command line w get utility for a regular Linux or the command line But it's nifty you can do that in Python real simple and I don't know. I don't know What do you guys think think that's a cool module? Are there any other cool modules? You know is there anything else you'd like to see or there anything you can inform me of some that I don't know about but Thanks for watching guys. I appreciate you checking this out and I'll see you in a later video