Conventions
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "first it sends the HTTP GET
request to the API server, then it reads in the response and stores the output into an api_response
variable."
A block of code is set as follows:
import urllib2 import json GOOGLE_API_KEY = "{Insert your Google API key}" target = "packtpub.com" api_response = urllib2.urlopen("https://www.googleapis.com/plus/v1/people? query="+target+"&key="+GOOGLE_API_KEY).read() json_response = json.loads(api_response) for result in json_response['items']: name = result['displayName'] print name image = result['image']['url'].split('?')[0] f = open(name+'.jpg','wb+') f.write(urllib2.urlopen(image).read()) f.close()
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in highlighted:
a = str((A * int(str(i)+'00') + C) % 2**M) if a[-2:] == "47":
Any command-line input or output is written as follows:
$ pip install plotly Query failed: ERROR: syntax error at or near
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Click on API & auth | Credentials. Click on Create new key and Server key."
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.