Skip to content

Instantly share code, notes, and snippets.

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
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.