import requests
import json
from datetime import datetime

import time
import os
import urllib3

#Get list of active and unactive driver 

####Get blocked drivers data###
URLBlocked= 'https://api-smp.jugnoo.in/get_all_suspended_drivers?'
URLActive= 'https://api-smp.jugnoo.in/get_driver_details_panel?'
#City=1826 #Setif
Token="ad211e959dca17540215f5fca67a6404"

DriverDetails= os.path.dirname(os.path.abspath(__file__)) + '//driverdetails.json'
#print (DriverDetails)
Category = 2
PARAMS= {
    #"city": City,
    "token": Token,
    "category":Category
        }

BlockedDriversObject = json.loads(requests.get(url = URLBlocked, params = PARAMS).text)
BlockedDrivers = BlockedDriversObject["data"]

####Get active drivers data##### 

ActiveDriversObject = json.loads(requests.get(url = URLActive, params = PARAMS).text)
ActiveDrivers = ActiveDriversObject["data"]

####Combine drivers info
BlockedDrivers.append("separator")
DriversInfo= BlockedDrivers+ActiveDrivers

with open(DriverDetails, "w") as outfile:
     json.dump(DriversInfo, outfile)
