JSON and the REST Architecture (Chapter 13)

دوره Using Python to Access Web Data ، فصل 6 : JSON and the REST Architecture (Chapter 13)

درباره‌ی این فصل:

In this module, we work with Application Program Interfaces / Web Services using the JavaScript Object Notation (JSON) data format.

این شامل 12 زیر است:

He's got sort of a dry sense of humor and I encourage you to watch the interview that I did with Douglas Crockford. The last few years, like I say, because of so much data is being moved between the browsers and back ends and JSON is pretty much the serialization format that's being used there. And so what happens is is that this JSON is not as rich a representation as XML, but because it's simple and it maps directly onto the internal structures that we have in all these languages, it's a lot easier to use.

Which turns this set of curly braces, spaces, commas and perhaps syntax errors into a structured object. Now the difference between XML and json is that this turns into a Python dictionary with key value pairs, okay? And so I'll put my little square brace back in so it's not syntactically broken.

And if you look at other data representations like the property lists that were used at, at NeXT and then later at Apple, except for a couple of cosmetic changes, it's the JSON notation as well. And we'd developed a platform for doing applications which could be delivered through unmodified web browsers, what today is called AJAX. But we produced some brilliant demonstrations and we were starting to make some progress in trying to convince, you know, potential customers that they should adopt the style of application and development.

And if you start searching, they take your search, and send it to the hotel system, and get a bunch of JSON or XML data back, and show it to you like, whoa, the airline knows something about cars, and it knows how much the cars cost at this city, one of 10,000 cities around the world or whatever. because the hotels want customers, and if the airline brings hotels, but then there's this service, and then somebody has to, the airline company person has to write some code that reads the data from the car rental company, and back and forth, and so everyone has to figure all this stuff out. And we talk about these things in the form of APIs, application program interfaces, which are ways to use web protocols to access data on systems, using well-defined and structured approaches.

Results are logged by a virtual learning environment, but how much of that data is shared with a management system that is tracking progression against funding? MyGrid is a project that provides a shared toolkit for creating experiments by coordinating the information flow between distributed resources and services. It is in this context that the e-Framework, a successful and expanding international initiative, works to make sense of the service-oriented approach for the education and research community.

There's this thing called an application programming interface or API. And so the way this works if you were to read that documentation, is that you hit a URL, mapsgoogleapis.com and all the stuff is in the URL is in the documentation, and then you give it a parameter after this question mark, address equals, and then there's a way that you encode these parameters. And you can complain about that, but hey, Google just says you want to use our thing, learn this syntax, write this code.

And so I just take that service URL for Google Maps API, I found that somewhere in the documentation. We're going to read the whole document and because it's UTF-8 coming from the outside world we want it turned into Unicode inside our application, we say dot decode. Next thing we're going to do is call json dump s, which is the opposite of load s which takes this dictionary that includes the arrays and we're going to pretty print it with an indent of four.

Google has servers and buildings, and staff, and researchers, they wrote the code in the first place, they accumulated all the data, they did all the searching. This dumps takes this JSON structure and then prints that out in a pretty way, with an indent, with curly braces and stuff like that. To formats like XML and JSON, to the notion of applications that begin to be distributed running on different computers connected via network.

This has to do with the fact that HT, that were using HTTPS and Python doesn't have enough certificates put into it by default for a lot of reasons, but our quick and dirty way is they turn them off. But now I'm going to run Python twtest.py, so twrl it's going to read hidden and now these keys and secrets are my real ones, that I haven't shown you. (Laughing) Well so, now I have my first most five recent friends are stephteasley, liveeduofficial, Livecodingtv, nabgilby And GreggyCrueger, so there are their statuses and I tore all this JSON apart using twitter2.py.

And we have a bunch of people, and I'm gonna let them introduce themselves, so. I'm Derek and can't believe I got to meet the famous Dr. Chuck. I'm just getting back into education, and this has been a really nice place to start.

So for me, Coursera is just more to learn more about the world around me, and to listen to professors from other great universities teach. And so a nontechnical person, but I've always been interested in technology, which is what drew me to Dr. Chuck's course, which is excellent. I hope that they keep on doing these things and they keep it interesting, and they do encourage professors to meet the people that they are teaching.

I work in my university as a instructor and because of the Python class, I forgot the syntax of that was embarrassing in my job. I'm Kevin, I've only come from London, it's been really good to hear how Coursera has been put together and how you make the course and thank you. I work as a learning technologist and I'm interested in doing a Python course to bring my programming skills up to date.

مشارکت کنندگان در این صفحه

تا کنون فردی در بازسازی این صفحه مشارکت نداشته است.

🖊 شما نیز می‌توانید برای مشارکت در ترجمه‌ی این صفحه یا اصلاح متن انگلیسی، به این لینک مراجعه بفرمایید.