当前位置: 首页 > news >正文

网站开发需要哪些语言建网站算法

网站开发需要哪些语言,建网站算法,专业做汽车的网站,公司装修合同模板需求#xff1a; 每天早上起来可以看看天气预报#xff0c;然后顺便当个闹钟使 思路是这样的#xff1a; 模块一#xff1a;采用yahoo weather api获取北京的天气 模块二#xff1a;通过网页版飞信#xff0c;模拟飞信登陆#xff0c;给自己发短信 模块三#xff1a;发…需求 每天早上起来可以看看天气预报然后顺便当个闹钟使 思路是这样的 模块一采用yahoo weather api获取北京的天气 模块二通过网页版飞信模拟飞信登陆给自己发短信 模块三发送信息   一。get_yahoo_weather.py #!/usr/bin/env python #codingutf-8 import urllib2 from xml.etree import cElementTree as ET class GetWeather:def __init__(self):self.weather self.makexml()def makexml(self):url http://weather.yahooapis.com/forecastrss?w2151330ucres urllib2.urlopen(url)xmlfile open(yahoo.xml,w)xmlfile.writelines(res.read())xmlfile.close()return self.xmlET()def xmlET(self):tree ET.ElementTree(fileyahoo.xml)forecast []for elem in tree.iter(tag{http://xml.weather.yahoo.com/ns/rss/1.0}forecast):forecast.append(elem.attrib)return self.msg(forecast)def msg(self,forecast):msg_data fmt \n%s %s %s %s\n%(日期,天气,最高温,最低温)msg_data fmtfor i in forecast:msg_data %s %s %s %s%(i[date],i[text],i[high],i[low])msg_data \nreturn msg_dataif __name__ __main__:w GetWeather()print w.weather 二。fetionsimu.py #!/usr/bin/env python #codingutf-8import cookielib import urllib import urllib2 import json import re import timedef fetion(weather_msg no data):cj cookielib.LWPCookieJar()opener urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))urllib2.install_opener(opener)t time.localtime()print t.tm_year,t.tm_mon,t.tm_mdayprint loginingurlbase http://f.10086.cn/im5/ response_text urllib2.urlopen(urlbase)response_text response_text.read()partten re.compile(rlogin/login\.action\?mnative\dt\d)urlplus partten.search(response_text)urlcomplete urlbase urlplus.group(0) # print urlcompleteqheader {Referer:urlcomplete}args {m:your phone number,pass:your password}logurl http://f.10086.cn/im5/login/loginHtml5.actionreq urllib2.Request(logurl,urllib.urlencode(args),qheader)jump opener.open(req)page jump.read() # print pagepage json.loads(page)if page[nickname] LGY:print login successfullyelse:print error in pass or usernamesendmsgurl http://f.10086.cn/im5/chat/sendNewGroupShortMsg.actionmsg_data {touserid:page[idUser],msg:weather_msg}msg_back urllib2.Request(sendmsgurl,urllib.urlencode(msg_data),qheader)msg_jump opener.open(msg_back)msguse msg_jump.read()msguse json.loads(msguse)if msguse[info] u发送成功:print send successfullyelse:print msguseprint send failed if __name__ __main__:fetion() 三。sendweather.py #!/usr/bin/env pythonimport time from get_yahoo_weather import GetWeather from fetionsimu import fetion def sendmsg(w):fetion(w)if __name__ __main__:w GetWeather()sendmsg(w.weather)   最后加入开机启动 用crontab -e编辑开机启动项 0 7 * * * /test/mkfun/sendweather.py /test/mkfun/sdwthmsg.log 21 然后就ok了。。。转载于:https://www.cnblogs.com/lgy6534588/p/3459120.html
http://www.pierceye.com/news/906390/

相关文章:

  • 福泉市自己的网站某个产品营销推广方案
  • 金坛市建设局网站微信网站有什么作用
  • 设计建网站今天的最新消息新闻
  • 电商行业建设网站ui网页设计培训学校
  • fineui 如何做网站私密浏览器免费版片视频动漫
  • 产地证是在哪个网站上做一起做网店下载安装
  • 舞钢市城乡建设局网站阿里巴巴网站谁做的
  • 巴彦淖尔市网站制作网站不收录怎么解决
  • 站群源码长春建设网站公司哪家好
  • 石家庄网站建设雨点牛wordpress qq登录免费
  • 有网站如何做淘宝客荆门市城乡建设管理局网站
  • 综合性门户网站列举如何拥有自己的微信小程序
  • 我图网类网站建设做外贸哪个网站最好
  • 做网站后台运营这个工作怎么样成都网络推广哪家好
  • angularjs做的网站有哪些wordpress 文章
  • 全国网站建设公司排名wordpress功能强大的主题
  • 做网站用c 还是php番禺制作网站平台
  • 营销网站运营的基本环节郑州大学现代远程教育 《网页设计与网站建设》个人主页
  • 网站建设合同是谁开的wordpress装主题需要ftp
  • 新乡门户网站建设方案开启wordpress upwn
  • 烟台企业自助建站系统浙江网站seo
  • 北京婚纱摄影网站珠海网站建设怎样
  • 用什么软件来做网站域名网安备案
  • 能打开各种网站的浏览器推荐制作小网站
  • 山东公司网站开发好看的个人博客主页
  • 长沙优化网站获客软件最新网页游戏排行榜2021
  • 学校网站 建设网络系统管理与维护电大考试题
  • 中文域名转码网站琼筑网站是哪家做的
  • iis 网站访问权限毕设做网站的过程
  • 俱乐部网站模板有什么外贸网站