comments = c.get_comments()
            done = False

            for cmt in comments:
                #pprint.pprint(cmt)
                txt = cmt['data']['text']
                if 'GeoCode' in txt:
                    done = True
                else:
                    #print ('Hmm' + txt)
                    pass
            #print
            if done:
                print("Done", c)
            else:
                print("Todo", c)

                g = re.search(r'Transcript:(.+)', c.description)
                if g:
                    x = g.group(1)
                    for y in parse_sms.process(x):
                        # now we geocode this
                        gc = geocoder.geocode(y)
                        gc2 = pprint.pformat(gc)
                        c.comment("Identified Address: " + y)
                        c.comment("GeoCode: " + gc2)
                        done = True
                if not done:
                    c.comment("GeoCode: Failed")
            comments = c.get_comments()
            done = False
            
            for cmt in comments :
                #pprint.pprint(cmt)
                txt = cmt['data']['text']
                if 'GeoCode' in  txt:
                    done = True
                else:
                    #print ('Hmm' + txt)
                    pass                    
            #print
            if done :
                print ("Done", c)
            else:
                print ("Todo",c)

                g = re.search(r'Transcript:(.+)',c.description)
                if g:
                    x = g.group(1)
                    for y in parse_sms.process(x):
                        # now we geocode this
                        gc = geocoder.geocode(y)
                        gc2 = pprint.pformat(gc)
                        c.comment("Identified Address: " +  y)
                        c.comment("GeoCode: " +  gc2)
                        done = True
                if not done:
                        c.comment("GeoCode: Failed" )
Ejemplo n.º 3
0
        


for n in alld:
    x = alld[n]
    if (x['Street']):
        if len(x['Zip Exten']) > 0:
            addr= x['Street'] +"\n" + x['City'] + " " + x['State'] + "  "+ x['Zip'] + "-" + x['Zip Exten'] + ", USA"
        else:
            addr= x['Street'] +"\n" + x['City'] + " " + x['State'] + " "+ x['Zip']  + ", USA"



    u = False
    if 'GeoCode' not in x:
        gc = geocoder.geocode(addr)
        x['GeoCode']=gc
        u = True
            
    #print addr
    if x['Full Address']!=addr:
        x['Full Address']=addr
        u = True

    if u:
        print "Updating" + x['Name']
        data.update(
            {
                'Name' : x['Name']
            },
            x,