Py4e: Chapter 13
Which of the following dates is in ISO8601 format?
2002-05-30T09:30:10Z
What is the purpose of XML Schema?
To establish a contract as to what is valid XML
What kind of variable will you get in Python when the following JSON is parsed: { "id" : "001", "x" : "2", "name" : "Chuck" }
A dictionary with three key / value pairs
What happens when you exceed the Google geocoding API rate limit?
You cannot use the API for 24 hours
Which of the following is true about an API?
An API is a contract that defines how to use a software library
Which of the following is not true about the service-oriented approach?
An application runs together all in one place
Who is credited with getting the JSON movement started?
Douglas Crockford
Which of the following are not commonly used serialization formats?
HTTP, dictionaries, TCP
What protocol does Twitter use to protect its API?
OAuth
Which of the following is a web services approach used by the Twitter API?
REST
Which of these two web service approaches is preferred in most modern service-oriented applications?
REST - Representational state transfer
What is "serialization" when we are talking about web services?
The act of taking data stored in a program and formatting it so it can be sent across the network
What is a good time zone to use when computers are exchanging data over APIs?
Universal Time / GMT
Looking at the following XML, what text value would we find at path "/a/c/e" <a> <b>X</b> <c> <d>Y</d> <e>Z</e> </c> </a>
Z
In the following XML, which node is the parent node of node e? <a> <b>X</b> <c> <d>Y</d> <e>Z</e> </c> </a>
c
What is the method to cause Python to parse XML that is stored in a string?
fromstring( )
In the following XML, which are attributes? <person> <name>Chuck</name> <phone type="intl"> +1 734 303 4456 </phone> <email hide="yes" /> </person>
hide, type
What Python library do you have to import to parse and handle JSON?
import json
What is the method used to parse a string containing JSON data so that you can work with the data in Python?
json.loads()
In this XML, which are the "simple elements"? <people> <person> <name>Chuck</name> <phone>303 4456</phone> </person> <person> <name>Noah</name> <phone>622 7421</phone> </person> </people>
name, phone
If you were building an XML Schema and wanted to limit the values allowed in an xs:string field to only those in a particular list, what XML tag would you use in your XML Schema definition?
not xs:element or xs:sequence
What library call do you make to append properly encoded parameters to the end of a URL like the following: http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=Ann+Arbor%2C+MI
urllib.parse.urlencode()
What header does Twitter use to tell you how many more API requests you can make before you will be rate limited?
x-rate-limit-remaining
If the following JSON were parsed and put into the variable x, { "users": [ { "status": { "text": "@jazzychad I just bought one .__.", }, "location": "San Francisco, California", "screen_name": "leahculver", "name": "Leah Culver", }, ... what Python code would extract "Leah Culver" from the JSON?
x["users"][0]["name"]
What is the name of the Python 2.x library to parse XML data?
xml.etree.ElementTree