If the stock quote of any company is of interest to you, this recipe can help you to find today's stock quote of that company.
We assume that you already know the symbol used by your favorite company to enlist itself on any stock exchange. If you don't know, get the symbol from the company website or just search in Google.
Here, we use Google Finance (http://finance.google.com/) to search for the stock quote of a given company. You can input the symbol via the command line, as shown in the next code.
Listing 6.4 describes how to search for Google stock quote, as shown:
#!/usr/bin/env python # Python Network Programming Cookbook -- Chapter - 6 # This program is optimized for Python 2.7. # It may run on any other version with/without modifications. import argparse import urllib import re from datetime import datetime SEARCH_URL = 'http://finance.google.com/finance?q=' def get_quote(symbol): content = urllib.urlopen(SEARCH_URL...