Chapter 13: Python and Web Services Flashcards
A contract between applications that defines the patterns of interaction between two application components.
API
Application Program Interface
A built-in Python library used to parse XML data.
ElementTree
import xml.etree.ElementTree as ET
Language-independent data-interchange format based on JavaScript objects.
Best for exchanging lists, dictionaries, or other internal information between programs, especially interactive web applications written in JavaScript
JSON
JavaScript Object Notation
import json
When an application is made of components connected across a network.
SOA
Service-Oriented Architecture
Very structured language not concerned with formatting content. Format used for storing, sending and receiving data that is then formatted by HTML for display of document or webpage. User-definable tags.
XML
eXtensible Markup Language
XML opening and closing tag format
<element>
</element>
A branch of an XML tree that can have some text, some attributes, and other nested elements
element / node
XML self-closing tag notation if element is empty (has no content)
< element / >
XML example format
data = ‘’’
<person>
<name>Chuck</name>
<phone>
\+1 734 303 4456
</phone>
<email></email>
</person>
’’’
Method that converts XML string to XML tree
.fromstring()
tree = ET.fromstring(data)
function to search XML tree and locate element that matches specified tag
find()
tree.find(‘name’).text
tree.find(‘email’).get(‘hide’) -prints hide attribute ‘yes’
method to retrieve a Python list of subtrees that represent the node structures in the XML tree
.findall()
lst = stuff.findall(‘parent node/target nodes’)
JSON method to parse json string and extract list / dictionary
json.loads()
A unique identifier used to locate a resource on the internet. Includes a protocol (http) and a domain name that specifies its location on a computer network
aka web address
URL
Uniform Resource Locator
Language used by web browsers to interpret and compose text, images, and other material into visible or audible web pages.
HTML
Hypertext Markup Language