This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.enterprise import adbapi | |
from twisted.python import log | |
import MySQLdb | |
class ReconnectingConnectionPool(adbapi.ConnectionPool): | |
"""Reconnecting adbapi connection pool for MySQL. | |
This class improves on the solution posted at | |
http://www.gelens.org/2008/09/12/reinitializing-twisted-connectionpool/ | |
by checking exceptions by error code and only disconnecting the current |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
def get_player_profiles(player_list): | |
# Returns a dict of player profile URLs to be used in the next step | |
# Dict will hold player profile pages indexed by player name | |
player_profile_urls=dict.fromkeys(player_list) | |
for n in player_list: | |
names=n.split(' ') | |
# Search for the player names at NFL.com to get their individual player profiles, which contain the | |
# data we ultimately want. |
NewerOlder