美文网首页
python发送新库提醒到手机

python发送新库提醒到手机

作者: Oneshot_fea8 | 来源:发表于2019-01-12 16:09 被阅读0次
# https://api.github.com/search/repositories?q=topic:crawler+language:python+created:2018-02-08
# https://api.pushover.net/1/messages.json?token=xx&user=xx&message=xx

# get_info_list -- push_it

from datetime import datetime
import requests


def get_info_list():
    api = 'https://api.github.com/search/repositories?q='
    query = 'topic:crawler+language:python+'
    when = 'created:' + str(datetime.now()).split()[0]
    full_url = api + query + when
    print(full_url)
    r = requests.get(full_url)
    return r.json()['items']


def make_message(repo_info):
    title = repo_info['name']
    url = repo_info['html_url']
    message = repo_info['description']
    token = 'xxx'  # 这里需要换成你的 token
    user = 'xxx'  # 这里需要换成你的 pushover user id
    api = 'https://api.pushover.net/1/messages.json?'
    template = 'token={token}&user={user}&message={msg}&title={t}&url={url}'
    query = template.format(
        token=token,
        user=user,
        msg=message,
        t=title,
        url=url
    )
    full_url = api + query
    return full_url


def push_it(message):
    requests.post(message)
    print('Done')


info_list = get_info_list()
for info in info_list:
    message = make_message(info)
    push_it(message)

相关文章

  • python发送新库提醒到手机

  • 03 发送新库提醒到手机

    这一个工作实际上分为两步,第一步:请求接口,第二步:使用Pushover软件来推送到手机上。总之就是,需要把api...

  • Linux中通过SHELL发送邮件

    笔者做过做过使用python发送邮件-Python使用yagmail库发送邮件[https://www.jia...

  • Python—Email

    Python自动发送邮件,使用到python内置库email和 smtplib协议库。 运行结果: G:\Ana...

  • Python自动化测试requests模块

    一、简介 requests库是 python 用来发送 http 请求。它是 Python 语言里网络请求库中最好...

  • python-轻松发邮件

    前言 有时候我们需要发送邮件,来触发提醒一些事情,那么python有没有很简单的邮件库,答案是有的。 今天就跟大家...

  • urllib库的介绍

    什么是urllib库? 是python用来模拟http发送请求消息的库,是python自带的 常用的有: urll...

  • 03_基本库的使用

    urllib库 python2中,由urllib和urllib2两个库来发送请求,python3中没有urllib...

  • 2018-08-28

    爬虫的基本流程 一、发送HTTP请求(Request)通过Python库向目标站点发送HTTP请求,等待服务器响应...

  • centOS系统上Python错误OSError: [Errno

    我遇到这个错误是因为我在用python的smtplib库发送邮件,总是到这里就报错。。。在我本机是没有问题的,放到...

网友评论

      本文标题:python发送新库提醒到手机

      本文链接:https://www.haomeiwen.com/subject/wvdcdqtx.html