padherder_proxy.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:padherder_proxy 作者: jgoldshlag 项目源码 文件源码
def is_out_of_date(main_tab):
    session = requests.Session()
    session.headers = { 'accept': 'application/vnd.github.v3+json',
                        'user-agent': 'jgoldshlag-padherder_sync_' + PH_PROXY_VERSION,
                      }

    session.mount('https://', requests.adapters.HTTPAdapter(pool_connections=1, pool_maxsize=1))
    try:
        r = session.get('https://api.github.com/repos/jgoldshlag/padherder_proxy/releases')
    except Exception as e:
        evt = custom_events.wxStatusEvent(message='Error checking for updates: %s' % e)
        wx.PostEvent(main_tab, evt)

    if r.status_code != requests.codes.ok:
        evt = custom_events.wxStatusEvent(message='Error checking for updates: %s %s' % (r.status_code, r.content))            
        wx.PostEvent(main_tab, evt)

    releases = json.loads(r.content)
    current_ver = LooseVersion(PH_PROXY_VERSION)
    for rel in releases:
        rel_version = LooseVersion(rel['tag_name'][1:])
        if rel_version > current_ver:
            return True

    return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号