예제 #1
0
def test1():
    #url ="http://en.wikipedia.org/wiki/Topness" #Works
    url = "https://en.wikipedia.org/wiki/Bottom_quark"  #Doesn't work
    page = getPage(url)
    for chunk in emulateSms(page, size=160):
        print chunk
        print byte_len(chunk)
        print "-------------------------------"
예제 #2
0
파일: getData.py 프로젝트: spandanb/ipos
def test1():
    #url ="http://en.wikipedia.org/wiki/Topness" #Works 
    url ="https://en.wikipedia.org/wiki/Bottom_quark" #Doesn't work
    page = getPage(url)
    for chunk in emulateSms(page, size=160):
        print chunk
        print byte_len(chunk)
        print "-------------------------------"
예제 #3
0
파일: streamData.py 프로젝트: spandanb/ipos
def emulateSms(data, size=160, add_prologue=True):
    """
    Emulates how some arbitrary text string will be 
    fragmented when sent over SMS using Twilio
    """
    
    #Twilio enforces this restriction
    if byte_len(data) > 1600:
        print "Unable to end message longer than 1600 chars"
        return

    if add_prologue: 
        prologue = "Sent from your Twilio trial account - "
        data = prologue + data

    for chunk in chunk_iter(data, size=size):
        yield chunk
예제 #4
0
def emulateSms(data, size=160, add_prologue=True):
    """
    Emulates how some arbitrary text string will be 
    fragmented when sent over SMS using Twilio
    """

    #Twilio enforces this restriction
    if byte_len(data) > 1600:
        print "Unable to end message longer than 1600 chars"
        return

    if add_prologue:
        prologue = "Sent from your Twilio trial account - "
        data = prologue + data

    for chunk in chunk_iter(data, size=size):
        yield chunk
예제 #5
0
파일: streamData.py 프로젝트: spandanb/ipos
def test2():
    data = "012345678[9"
    for sms in chunk_iter_offset(data, size=5, offset=3):
        print '"{}", byte_len is {}'.format(sms, byte_len(sms))
        print "------------------"
예제 #6
0
파일: streamData.py 프로젝트: spandanb/ipos
def test1():
    data = "012345678[9"
    for sms in emulateSms(data, size=5, add_prologue=False):
        print '"{}", byte_len is {}'.format(sms, byte_len(sms))
        print "------------------"
예제 #7
0
def test2():
    data = "012345678[9"
    for sms in chunk_iter_offset(data, size=5, offset=3):
        print '"{}", byte_len is {}'.format(sms, byte_len(sms))
        print "------------------"
예제 #8
0
def test1():
    data = "012345678[9"
    for sms in emulateSms(data, size=5, add_prologue=False):
        print '"{}", byte_len is {}'.format(sms, byte_len(sms))
        print "------------------"