适用于小公司的订餐系统Python脚本,订餐python,#!/usr/bin/e
适用于小公司的订餐系统Python脚本,订餐python,#!/usr/bin/e
#!/usr/bin/env python# -*- coding: gbk -*-#www.iplaypy.comimport 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 date def main(argv=None): auditor = "username" url = "http://192.168.14.27/cgi-bin/cgi_audit_login" #url = "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 = "http://192.168.14.27/cgi-bin/cgi_audit" result = http_send(auditor,url2,employee,order_id,0) print gettime() print result if __name__ == "__main__": sys.exit(main())
编橙之家文章,
相关内容
- python md5有生成与应用示例,pythonmd5,python md5有生
- 解决Python2不支持datetime的json encode问题,python2json,解决
- Python定期查询域名状态并完成记录的小脚本,python域名
- Python完成远程登陆RouterOS执行并返回命令的操作,pyth
- python编写ini文件的方法,,from ConfigP
- python方法筛选特定宽度的图片方法,,记得之前在做图片
- 完成自动生成CMake脚本的python方法,cmakepython,下面一段
- python对比并输出多文件夹内的不同文件,python对比,py
- Python批量下载人人网相册图片的实现,,Python批量下载人
- 关于webpy中form radio单选框的bug修复,webpyradio,这是我在
评论关闭