2022-02-16 19:47:58
import requests
import pandas as pd
import csv
 
data=pd.read_csv("input_file/upay_district_list_with_address_unique.csv",keep_default_na=False)
name_en=data['name_en'].tolist()
name_bn=data['name_bn'].tolist()
district_en=data['district_en'].tolist()
district_bn=data['district_bn'].tolist()
address_en=data['address_en'].tolist()
address_bn=data['address_bn'].tolist()
thana_en=data['thana_en'].tolist()
thana_bn=data['thana_bn'].tolist()
 
def parse(input_addr):
    response = requests.post('http://rupantor.bmapsbd.com/test/transparse', data = {'addr':input_addr})
    return response.json()
 
# d = parse("rajshahi")
# print(d['confidence_score_percentage'])
 
 
with open('Output Folder/Rupantor_Upai_data_Parsedd.csv','w',newline='') as f:
    writer=csv.writer(f)
    cnt=0
    writer.writerow(["name_en","name_bn","district_en","district_bn","address_en","address_bn","thana_en","thana_bn","geocoded_address","confidence_score"])
    for i in range(0,len(district_en)):
        n=address_en[i]
        if "DHAKA" in district_en[i]:
            cnt+=1
            print(cnt)
            ans=parse(n)
            geocoded_Address=ans['geocoded'].get('Address')
            confidence_score=ans['confidence_score_percentage']
            writer.writerow([name_en[i],name_bn[i],district_en[i],district_bn[i],address_en[i],address_bn[i],thana_en[i],thana_bn[i]])
 
 
 
 
 
 
 
 
 
 
Invalid Email or Password