 Hey, what's up guys welcome back to another Python video. We're looking at a whole new module this time around we're looking at a new series for XML RPC Lib And you're probably looking at me like what is that? Let's check it out. I'm on Google right now You can just kind of type in Python Xml RPC Lib and our first result here is some nice Python documentation and we're just gonna hop right into it So the first thing that you will see is this note This notification the XML RPC module has been renamed to Xml RPC dot client in Python 3 The 2 to 3 tool will automatically adapt imports when converting your sources to Python 3. I mean, whatever. I'm using Python 2.7 something or other not Python 3 if you're using Python 3, that's your business go do what you want to do You do you man. I'll do me. So yeah, I'm using Python 2.7 So I'm not gonna worry about Xml RPC dot client and all that jazz and the 2 to 3 tool But I'm just gonna look at what we've got here working XML RPC Lib, okay Going to the documentation the first thing that it kind of presents to you is that XML RPC is a remote procedure call method that uses XML Passed by HTTP or hypertext transfer protocol as a transport with it a client can call methods like Functions in code and in programming methods with parameters on a remote server and the server is named by URI or uniform research I think identifier Anyway, that's like a URL address or something you type in your address bar on your browser. It's a web page It's not a web page, but it's the internet, you know HTTP the internet blah blah blah and it gets you are returned Structured data, so this module supports writing XML RPC client code and it handles all the details of translating between Comfortable Python objects and XML on the wire There's a warning that it's not secure against maliciously constructed data If you need to parse untrusted or authenticated data check out XML vulnerabilities and stuff like that There's a note here that it's changed in version 2.79 for HTTPS URIs for secure Hypertext transfer protocol The library now performs all the necessary certificate and host name checks by default. That's cool. I think If we just kind of move on here looking through the documentation The first thing that it tells us is about this nifty class called server proxy And this is kind of the bare bones of the library from what I understand so Just going through the reading here a server proxy instance is an object that manages communication with the remote XML tack RPC server the required first argument is a URI okay uniform research indicator not identifiers I was I was close and will normally be the URL of the server The optional second argument is a transport factor instance more information Some of the stuff I'm not going to go through because in this tutorial in this series I'm going to get through this on a little bit of a higher level. I'm going to show you what the library does What you can do with it? But I'm not going to show you what more you can do with it So I'll show you some stuff, but not totally not everything that you can manipulate with this library If you want to learn more about it, dude, do you own reading do you own research? That's awesome. I encourage that The return to instance is a proxy object with methods like functions that can be used to invoke Corresponding RPC calls on the remote server if the remote server supports the introspection API The proxy can also be used to query the remote server for methods it supports Also known as service discovery and fetch other server associated metadata That's kind of cool. So that means like you can figure out What the server can give you like what methods can you use what functions can you call and sort of thing? So this instance the server proxy takes Python basic types and argument and an argument Sorry, it will return Python basic types and classes things that are conformal the following So these are just data types that you can use between Python and the XML RPC It looks like it uses pretty much the normal stuff that we use in Python and Also dates and binary data. So in case you want to use any of those you can I'm probably not going to cover them but It says here. These are the full set of data types supported by the convention XML RPC Talks about raising faults and errors and stuff like that Here's another line serverier Wow, I talk trust me. I know English. I'm intelligent. I promise Server is retained as an alias for server proxy for backwards compatibility new code should use server proxy and Server proxy up top here is The thing that we were just reading. This is the class that we're using to create stuff. So you can use server You can remove this word proxy, but they say at least they encourage Using server proxy Okay, and I also want to move on to this XML RPC how to Yeah, let's let's go through that before we go into anything else so I'm gonna click on this and it takes me right to TLDP org was like the Linux documentation product project super awesome thing So this page Describes how to use XML RPC to implement clients and servers in a variety of languages provides example code and pearl Python Hey Python, that's what we're gonna be looking at other languages. So, okay, that's cool So in this table of contents my eyes went right to what is XML RPC? Let's check that out Now it says that XML RPC. Oh, there's a website for it That's cool We can look through that too XML RPC is a simple portable way to make remote procedure calls over HTTP It can be used with Pearl Java Python C C++ PHP and many other programming languages, okay Implementations are available for Unix windows and the Macintosh the Macintosh Looks like it shows some pearl code. It also shows some Python code and It's using our library XML RPC lib cool. That's the one. We're just gonna check out Look at the code here. It imports the library creating a new variable or object returned by The server class. Oh and just like our documentation said server works, but most people should now use server proxy It takes the URL or the URI of where the RPC lives on the internet and then It looks like it's calling a function From the server and getting return some data So that's all it is really. It's just running a function calling a function You're calling the server It's like it's cool It kind of it kind of seems like a programmer server like it's just storing a bunch of functions that you might want to use later on in your life That's kind of nifty. I guess and This in the following few chapters you'll learn how to write these clients and servers in a variety of programming languages super cool How it works Fully described in Dave Weiner's official specification. Oh, hey, okay. This is the same website that we were just at Um And it's okay, it's XML all behind the scenes that makes sense XML RPC is a remote procedure calling protocol that works over the internet We've covered that an XML RPC message is an HTTP post request Like you simply see on websites and that's a good thing the body of the request is an XML a Procedure executes on the server and the value returned is also formatted XML. That's kind of cool So examples here. Oh, thanks, Symantec Thanks for your help Back to what I was talking about or what I was trying to talk about, you know me This is the behind-the-scenes stuff of how the library and XML RPC really works I'm not gonna show you all this but I want you to know that it exists So if you want to read up on it, you totally can Support a data type so everything we were just kind of looking at in the documentation of our library There's the history XML other protocols. I'm not really worried about that Common XML RPC interfaces So these servers provide built-in methods they aren't part of XML RPC itself, but they make for handy add-ons Introspection. Hey, that's the same thing we were reading about like service discovery in the Python documentation discovering server APIs Ed Dumbbell proposed the following set of methods List methods method help Okay, and they always return either an array or string or an array I would think if a server supports these methods you can print it out or print out some documentation So here's the same Python code import XML RPC lib Server creating the server same thing we were looking at beforehand and for each of these methods that you've got in list methods It'll return them to you. It'll print what the method is and A help command for what it actually does what the function will do So these methods are supported by servers written in PHP C and Microsoft Introspection support for Pearl Python and Java is available at XML RPC hacks page Check that one out Okay Looks like this page doesn't exist That's fine. We'll just go on our merry way To demonstrate XML RPC here's the following API and as many languages as possible some indifference, okay This is just a function. They're gonna show off to us So let's check it out XML RPC with Pearl We're gonna look at Python and I know I saw it in the table of contents. Okay sweet next page using HTML RPC with Python next Installing it Here it is a Python client XML RPC lib Server URL that's just a string that saves the server connection page they just Okay, they just reach for the function they call it and Their return data and they can just use it in the code. That's super cool All right, is there anything more for us? Okay, no, it's then it just goes on to show other languages Java PHP All right, I'm gonna go back to our Documentation XML RPC live because I know there was another section. We were thinking about looking at Server proxy objects Instance has a method corresponding to each remote procedure call accepted by the XML RPC server I know you guys can read all this on your own and I mean I would recommend doing that this video is kind of for like a quick Crash course through it Servers that support the XML introspection API support some common method groups under the reserved system attributes List methods methods. Oh, hey, these are the same things. We were looking at in the yeah method help These are the same things we were looking at in the Linux documentation So this method returns a list of strings each one for the method or the function Supported by the server. That's pretty cool So you can just learn more about what it is that you're connected to and what you're looking at same thing with method help and Method signature sweet. All right So I Think I'm good with what I wanted to present to you in this video this video in this tutorial This one was just all about research Learning what this library can do and what it will do in the next video will actually take a look at the code and we'll just execute everything we just saw and At least we're kind of looking at researching and that way we can get a better feel for it And we can actually do it on our own. So that's it. I think I'm good I hope you guys are okay with this kind of learning style I know it's a little bit different from my normal series But this is the way that I wanted to at least present XML RPC lib. So onto the next video Thanks for watching guys, and I'll see you soon