import os
sys.path.append(r'C:\WebGIS\PythonLibraries')
import arial10
import cleanup
import datetime
from xlwt import Workbook, Borders, Font, XFStyle

# env
arcpy.env.qualifiedFieldNames = False
arcpy.env.overwriteOutput = True

# Out Path
PATH = r'C:\inetpub\wwwroot\TempFiles'
PATH_URL = 'http://lt0212x1g2676/TempFiles'
cleanup.remove_files(PATH, 1/96.0)
cleanup.remove_folders(PATH, 1/96.0)

def CreateExcelSpreadsheet(table, output_excel, use_alias=True):
    """Exports table to excel

    Required:
        table -- input table
        output_excel -- output excel table (.xlsx, .xls)

    Optional:
        use_alias -- use field alias name for column headers. Default is True
    """
    # build field dict
    fieldNames = [(f.name, f.aliasName) for f in arcpy.ListFields(table) if f.type != 'Geometry']
    fields = [f[1] if use_alias in ('true', True) else f[0] for f in fieldNames]
    widths = {i: arial10.fitwidth(f) + 1024 for i,f in enumerate(fields)}
sys.path.append(r'C:\WebGIS\PythonLibraries')
import restapi
import arcpy
import os
import cleanup
import zipfile
import json
import time

PATH = r'C:\inetpub\wwwroot\TempFiles'
DATE = time.strftime('%Y%m%d%H%M%S')
PATH_URL = 'http://lt0212x1g2676/TempFiles'

# clean up temp files folder
cleanup.remove_files(PATH, 1/96.0)
cleanup.remove_folders(PATH, 1/96.0, del_gdb=True)

def zipdir(path, out_zip=''):
    """zips a folder and all subfolders

    Required:
        path -- folder to zip

    Optional:
        out_zip -- output zip folder. Default is path + '.zip'
    """
    rootDIR = os.path.basename(path)
    if not out_zip:
        out_zip = path + '.zip'
    else:
        if not out_zip.strip().endswith('.zip'):