from server2022_new import server2022 import firebase_admin from firebase_admin import credentials from firebase_admin import db from firebase_admin import messaging import time import threading import os from numba import jit, cuda import requests cred = credentials.Certificate('servicekey.json') uid = 'TCXcp5VIsfhHZrh0nm2VsgBtcGy2' try: firebase_admin.initialize_app(cred, {'databaseURL': 'https://farmbase-b2f7e-31c0c.firebaseio.com/'}) except: print('fire running') idsArr = [] tempObj = {} try: pending_list = db.reference('PaidPolygonsByPolygonID').child('PMF').child(uid).get() for (p,q) in pending_list.items(): try: fieldid = q["fieldID"] polygonObj = db.reference('PaidMonitoredFields').child('PMF').child(uid).child(fieldid).child('Polygons').child(p).get() try: tempID = polygonObj["polygonID"] except Exception as e: idsArr.append(p) print(e) # r = requests.post('https://us-central1-farmbase-b2f7e.cloudfunctions.net/findHNIVillage', json = tempObj) except Exception as e: print(e) print('a1') tempObj["UID"] = uid tempObj["LandIDs"] = idsArr print(tempObj) r = requests.post('https://us-central1-farmbase-b2f7e.cloudfunctions.net/deleteAdminPolygons', json = tempObj) except Exception as e: print(e) print('a2')