Example #1
0
print lordsList.GetLordIDfname('Baroness Thatcher', None, '2006-05-01')
print lordsList.GetLordIDfname('The Archbishop of York', None, '2006-05-01')
print lordsList.GetLordIDfname('The Bishop of Southwell and Nottingham', None, '2006-05-01')

print memberList.matchfullnamecons("Anne Moffat", "East Lothian", "2006-01-22")
print memberList.matchfullnamecons("Anne Picking", "East Lothian", "2006-01-22")
print memberList.matchfullnamecons("Anne Moffat", "East Lothian", "2004-01-22")
print memberList.matchfullnamecons("Anne Picking", "East Lothian", "2004-01-22")

print memberList.canonicalcons("Aberdeen North", "2001-01-01")
print memberList.canonicalcons("Aberdeen North", "2005-05-06")

print memberList.matchdebatename("Solicitor-General", None, "2003-11-21")
print memberList.matchdebatename("The Advocate-General for Scotland", None, "2004-07-30")

print memberList.getmembersoneelection("uk.org.publicwhip/member/1238")
print memberList.getmembersoneelection("uk.org.publicwhip/member/1353")
print memberList.getmembersoneelection("uk.org.publicwhip/member/1357")

print memberList.matchdebatename("Mr. Mackay", None, "2003-11-21")
print memberList.matchdebatename("James Marshall", None, "2003-11-21")
print memberList.matchdebatename("Gareth Thomas", "Clwyd, West", "2003-11-21")
print memberList.matchdebatename("Gareth Thomas", None, "2005-05-07")

print memberList.matchfullnamecons("Mr. MacDonald", "Western Isles", "2005-04-01")
print memberList.matchfullnamecons("Mr. MacNeil", "Na h-Eileanan an Iar", "2005-04-01")
print memberList.matchfullnamecons("Mr. MacDonald", "Western Isles", "2005-05-07")
print memberList.matchfullnamecons("Mr. MacNeil", "Na h-Eileanan an Iar", "2005-05-07")

print memberList.matchfullnamecons("The Prime Minister", None, "2003-11-21")
# print memberList.matchfullnamecons("The Prime Minister", None, "1992-11-21")
Example #2
0
    #print  >>sys.stderr, "ID %s name %s cons %s" % (id, name, cons)
    personid = memberList.membertoperson(id)
    cons = cons.replace("&", "&")

    print '<personinfo id="%s" guardian_mp_summary="%s" />' % (personid,
                                                               personurl)
    url_match = re.search(
        '^http://www.guardian.co.uk/politics/person/(\d+)/(.*)$', personurl)
    guardian_aristotle_id = url_match.group(1)
    print '<personinfo id="%s" guardian_aristotle_id="%s" />' % (
        personid, guardian_aristotle_id)
    print '<consinfo canonical="%s" guardian_election_results="%s" />' % (
        cons.encode("latin-1"), consurl)

    # Majority
    setsameelection = memberList.getmembersoneelection(id)
    #print setsameelection

    # Grab swing from the constituency page
    again = 1
    # we retry URLs as sometimes (1 in 40) they fail (some
    # incompatibility between Guardian web server and Python url
    # library?)
    while again:
        print >> sys.stderr, "Trying %s" % consurl
        try:
            ur = urllib.urlopen(consurl)
            again = 0
        except:
            print >> sys.stderr, "---------------------- RETRYING URL"
            again = 1
Example #3
0
print lordsList.GetLordIDfname('Baroness Thatcher', None, '2006-05-01')
print lordsList.GetLordIDfname('The Archbishop of York', None, '2006-05-01')
print lordsList.GetLordIDfname('The Bishop of Southwell and Nottingham', None, '2006-05-01')

print memberList.matchfullnamecons("Anne Moffat", "East Lothian", "2006-01-22")
print memberList.matchfullnamecons("Anne Picking", "East Lothian", "2006-01-22")
print memberList.matchfullnamecons("Anne Moffat", "East Lothian", "2004-01-22")
print memberList.matchfullnamecons("Anne Picking", "East Lothian", "2004-01-22")

print memberList.canonicalcons("Aberdeen North", "2001-01-01")
print memberList.canonicalcons("Aberdeen North", "2005-05-06")

print memberList.matchdebatename("Solicitor-General", None, "2003-11-21")
print memberList.matchdebatename("The Advocate-General for Scotland", None, "2004-07-30")

print memberList.getmembersoneelection("uk.org.publicwhip/member/1238")
print memberList.getmembersoneelection("uk.org.publicwhip/member/1353")
print memberList.getmembersoneelection("uk.org.publicwhip/member/1357")

print memberList.matchdebatename("Mr. Mackay", None, "2003-11-21")
print memberList.matchdebatename("James Marshall", None, "2003-11-21")
print memberList.matchdebatename("Gareth Thomas", "Clwyd, West", "2003-11-21")
print memberList.matchdebatename("Gareth Thomas", None, "2005-05-07")

print memberList.matchfullnamecons("Mr. MacDonald", "Western Isles", "2005-04-01")
print memberList.matchfullnamecons("Mr. MacNeil", "Na h-Eileanan an Iar", "2005-04-01")
print memberList.matchfullnamecons("Mr. MacDonald", "Western Isles", "2005-05-07")
print memberList.matchfullnamecons("Mr. MacNeil", "Na h-Eileanan an Iar", "2005-05-07")

print memberList.matchfullnamecons("The Prime Minister", None, "2003-11-21")
# print memberList.matchfullnamecons("The Prime Minister", None, "1992-11-21")
Example #4
0
    # Match the name, and output basic URLs
    print >>sys.stderr, "Working on %s %s" % (origname, origcons)
    id, name, cons =  memberList.matchfullnamecons(origname, origcons, date)
    #print  >>sys.stderr, "ID %s name %s cons %s" % (id, name, cons)
    personid = memberList.membertoperson(id)
    cons = cons.replace("&", "&amp;")

    print '<personinfo id="%s" guardian_mp_summary="%s" />' % (personid, personurl)
    url_match = re.search('^http://www.guardian.co.uk/politics/person/(\d+)/(.*)$', personurl)
    guardian_aristotle_id = url_match.group(1)
    print '<personinfo id="%s" guardian_aristotle_id="%s" />' % (personid, guardian_aristotle_id)
    print '<consinfo canonical="%s" guardian_election_results="%s" />' % (cons.encode("latin-1"), consurl)

    # Majority
    setsameelection =  memberList.getmembersoneelection(id)
    #print setsameelection

    # Grab swing from the constituency page
    again = 1
    # we retry URLs as sometimes (1 in 40) they fail (some
    # incompatibility between Guardian web server and Python url
    # library?)
    while again:
        print >>sys.stderr, "Trying %s" % consurl
        try:
            ur = urllib.urlopen(consurl)
            again = 0
        except:
            print >>sys.stderr, "---------------------- RETRYING URL"
            again = 1