Python 公司订餐系统的审核脚本,python订餐,每次要手动审核别人的订餐
Python 公司订餐系统的审核脚本,python订餐,每次要手动审核别人的订餐
每次要手动审核别人的订餐,挺麻烦的,有时候忘记审核,有时候去审核别人还没点饭
#!/usr/bin/env python# -*- coding: gbk -*-#Using GPL v2#Author: xiaomage234@gmail.com#Version:0.1import sys,reimport urllib,urllib2from time import localtime,strftimedef http_send(u,url,employee='',order_id='',query=1): opener = urllib2.build_opener() if query == 1: postdata = urllib.urlencode({"u":u}) else: postdata = urllib.urlencode({"u":u,"employee":employee,"order_id":order_id,"audit":1,"reason":""}) request = urllib2.Request(url,postdata) body = opener.open(request).read() opener.close() return bodydef gettime(): date = strftime("%Y-%m-%d %H:%M:%S", localtime()) return datedef main(argv=None): auditor = "username" url = "<a href="http://192.168.14.27/cgi-bin/cgi_audit_login">http://192.168.14.27/cgi-bin/cgi_audit_login" #url = "<a href="http://mage.xunlei.com/ret.html">http://mage.xunlei.com/ret.html" patt = 'javascript:operation\\((.*?)\\)' ret = http_send(auditor,url) match = re.search(patt,ret,re.S|re.M) if match: data = match.group(1) else: print '%s:no data to audit!' % gettime() sys.exit() print data arrays = data.split(',') employee = arrays[1] employee = employee.replace("'","").strip() #print employee order_id = arrays[2] order_id = order_id.replace("'","").strip() #print order_id url2 = "<a href="http://192.168.14.27/cgi-bin/cgi_audit">http://192.168.14.27/cgi-bin/cgi_audit" result = http_send(auditor,url2,employee,order_id,0) print gettime() print resultif __name__ == "__main__": sys.exit(main())#该片段来自于http://byrx.net
相关内容
- 调用摄像头摄像及保存图片,调用摄像头摄像,#! /usr/
- Python 压缩文件(3),python压缩文件,制成tar+gzipim
- Python 压缩文件(2),python压缩文件,加入了tar环节,但是
- Python 解析xml(dom),python解析xmldom,from xml.dom
- Python中的工厂方法 funtional的思维来做 非oop的实现,f
- Python 自动连接ssh,Python连接ssh,#!/usr/bin/p
- md5Crack_V0.1,,Python语言: md
- python.递归遍历指定的目录,python递归遍指定,Python语言
- 网易新闻小爬虫.v0.1,网易新闻爬虫.v0.1,Python语言: 网易
- Python版的农历日历Calendar,功能简单,pythoncalendar,Pyth
评论关闭