Example #1
0
 def given_an_entry(self):
     self.entry = callerIdEntry()
     self.assertTrue(len(self.entry.parts) == 0)
     self.entry.fromString(
         '--DATE = 061913--TIME = 0848--NMBR = 8885551212--NAME = ISELLYOURSOUL  --'
     )
     self.assertTrue(len(self.entry.parts) == 4)
 def test_entries_comparable(self, read, printy):
     (read.is_callable().returns('y'))
     (printy.is_callable())
     self.given_an_entry()
     self.entry.chooseBlacklistEntry()
     entry2 = callerIdEntry()
     entry2.fromString('--DATE = 061913--TIME = 0848--NMBR = 8885551212--NAME = ISELLYOURSOUL  --')
     entry2.chooseBlacklistEntry()
     self.assertEquals(self.entry.getKey(), entry2.getKey())
     self.assertEquals(self.entry, entry2)
Example #3
0
 def test_entries_comparable(self, read, printy):
     (read.is_callable().returns('y'))
     (printy.is_callable())
     self.given_an_entry()
     self.entry.chooseBlacklistEntry()
     entry2 = callerIdEntry()
     entry2.fromString(
         '--DATE = 061913--TIME = 0848--NMBR = 8885551212--NAME = ISELLYOURSOUL  --'
     )
     entry2.chooseBlacklistEntry()
     self.assertEquals(self.entry.getKey(), entry2.getKey())
     self.assertEquals(self.entry, entry2)
Example #4
0
from lib.calleridentry import callerIdEntry

# sample input: --DATE = 032914--TIME = 1007--NMBR = 8885551212--NAME = V32913072900491--
pattern = re.compile('.-DATE = (.*)--TIME = (.*)--NMBR = (.*)--NAME = (.*)--')

raise NotImplementedError  # when you put in your password, take this out
wc = whocalled('YourUserName', 'YourPassword')

s = socket(AF_INET, SOCK_DGRAM)
s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
s.bind(('0.0.0.0', 9753))
print 'udp ready!'
BUFSIZE = 512
while True:
    data, addr = s.recvfrom(BUFSIZE)
    print('server received %r from %r' % (data, addr))

    result = pattern.match(data)
    if result:
        entry = callerIdEntry()
        entry.fromString(data)

        print "Number to look up: "
        #print result.group(3)
        entry.parts['NMBR'].strip()
        print "Score: "
        score = wc.getScore(result.group(3))
        print score
        #entry.parts['NAME'].strip()
        Notifier.notify('Score: %s' % score, title='Phone')
Example #5
0
# sample input: --DATE = 032914--TIME = 1007--NMBR = 8885551212--NAME = V32913072900491--
pattern = re.compile('.-DATE = (.*)--TIME = (.*)--NMBR = (.*)--NAME = (.*)--')

raise NotImplementedError  # when you put in your password, take this out
wc = whocalled('YourUserName', 'YourPassword')

s = socket(AF_INET, SOCK_DGRAM)
s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
s.bind(('0.0.0.0', 9753))
print 'udp ready!'
BUFSIZE = 512
while True:
    data, addr = s.recvfrom(BUFSIZE)
    print('server received %r from %r' % (data, addr))

    result = pattern.match(data)
    if result:
        entry = callerIdEntry()
        entry.fromString(data)

        print "Number to look up: "
        #print result.group(3)
        entry.parts['NMBR'].strip()
        print "Score: "
        score =  wc.getScore(result.group(3))
        print score
        #entry.parts['NAME'].strip()
        Notifier.notify('Score: %s' % score, title='Phone')

 def given_an_entry(self):
     self.entry = callerIdEntry()
     self.assertTrue( len(self.entry.parts) == 0 )
     self.entry.fromString('--DATE = 061913--TIME = 0848--NMBR = 8885551212--NAME = ISELLYOURSOUL  --')
     self.assertTrue( len(self.entry.parts) == 4 )