Esempio n. 1
0
#!/usr/bin/env Python
# coding=utf-8

from wxpy import *
from wechat_sender import Sender
import datetime
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import time
"""
    登陆微信,持续监听
"""
send = Sender()
time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
send.delay_send(content="信息",
                title="标题",
                remind=datetime.timedelta(minutes=59),
                time=time)
Esempio n. 2
0
def getNewFormatTime():
    """
    返回当前格式后的时间
    :return:
    """
    return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))


if __name__ == "__main__":
    send = Sender()

    # [1]拿到登陆成功的session
    session = login()
    send.delay_send(content="爬取帖子,抽取数据开始",
                    title="下课聊",
                    time=getNewFormatTime())
    # [2] 抓取昨天发布的全部帖子,一些小的栏目帖子不算
    # 获取上一天的年月日
    yesterday = getYesterday("%Y-%m-%d")
    print yesterday
    # 模拟抓取的时间戳
    # 0.0.0 的时间戳  23.59.59 的时间戳
    befor_timestamp = str(yesterday) + " 00:00:00"
    after_timestamp = str(yesterday) + " 23:59:59"
    print befor_timestamp
    beforTimestamp = getTimeStamp(befor_timestamp)
    afterTimestamp = getTimeStamp(after_timestamp)
    # 组拼成13位的时间戳
    beforTimestamp = str(beforTimestamp) + "000"
    afterTimestamp = str(afterTimestamp) + "999"