import fiona import requests import utm from geopy.geocoders import Nominatim import time import firebase_admin from firebase_admin import credentials from firebase_admin import firestore import csv import threading import os cred = credentials.Certificate('servicekey.json') try: firebase_admin.initialize_app(cred, {'databaseURL': 'https://farmbase-b2f7e-31c0c.firebaseio.com/'}) except: print('fire running') db = firestore.client() file = open("amro.csv") csvreader = csv.reader(file) header = [] header = next(csvreader) for row in csvreader: try: state = row[0] zone = row[1] amro = row[2] store = row[3] village = row[4] district = row[5] state = state.lower() zone =zone.lower() amro = amro.lower() store = store.lower() village = village.lower() district = district.lower() maindata = {} maindata["zone"] = zone maindata["amro"] = amro maindata["store"] = store maindata["village"] = village maindata["district"] = district maindata["state"] = state tag = village + "_" + district + "_" + store db.collection("coromandel").document(tag).set(maindata) time.sleep(1) except: print('error')