- 打印堆栈信息
import traceback
except exception as e:
msg = tarceback.format_exc()
print msg
- 获取当天0点和前一天零点
import datetime
today = datetime.datetime.today()
oneago = datetime.datetime(today.year, today.month, today.day-1, hour=0, minute=0, second=0)
nowday = datetime.datetime(today.year, today.month, today.day, hour=0, minute=0, second=0)
payload = {"server_ip":str(ip),"start_time":str(oneago),"end_time":str(nowday)}
注意把时间转换成字符串格式化的格式