zoukankan      html  css  js  c++  java
  • 蘑菇丁 自动打卡

    import urllib.request as ur

    import ssl
    import json
    context = ssl._create_unverified_context()
    def qiandao(token):
        data_s={
            'country': '中国',
            'address': '湖北省 · 中国农业银行',
            'province': '湖北省',
            'city': '湖北省',
            'latitude': '30.336959',
            'type': 'START',
            'longitude': '113.429182'
        }
        url = 'https://api.moguding.net:9000/attendence/clock/v1/save'
        headers = {
            'Authorization': token,
            'Content-Type': 'application/json; charset=UTF-8'
        }
        data=json.dumps(data_s)
        requests=ur.Request(url=url,data=data.encode("utf-8"),headers=headers)
      
        try:
            if json.loads(ur.urlopen(requests,context=context).read().decode())['code']==200:
                print('签到成功')
            else:
                print('如果签到失败就会发邮件')
                '''
                这里写发送邮件的方法
                '''
                pass
        except Exception as e:
            pass
    def logo():
        logo_data = {
            "phone":input('请输入蘑菇钉账号'),
            "password":input('请输入蘑菇钉密码'),
            "loginType":"android"
        }
        request_logo = ur.Request(
            url = 'https://api.moguding.net:9000/session/user/v1/login',
            data =json.dumps(logo_data).encode(),
            headers = {
                'Content-Type':'application/json; charset=UTF-8'
            }
        )
        try:
            token = json.loads(ur.urlopen(request_logo,context=context).read().decode())['data']['token']
            if token:
                qiandao(token)
        except Exception as e:
            datad = '<urlopen error Remote end closed connection without response>'
            if datad==str(e):
                print('网络连接超时')
            else:
                print('账号或密码输入错误')
            pass
    if __name__ == '__main__':
        logo()
  • 相关阅读:
    android ListView加载不同布局
    实例演示如何在spring4.2.2中集成hibernate5.0.2并创建sessionFactory
    【翻译】Ext JS最新技巧——2015-10-21
    Android Studio下使用NDK的流程
    Android Studio JNI javah遇到的问题
    题解报告:hdu 1062 Text Reverse
    题解报告:hdu 1039 Easier Done Than Said?
    ACM_逆序数(归并排序)
    hdu 1556 Color the ball(区间修改,单点查询)
    hdu 1754 I Hate It(线段树)
  • 原文地址:https://www.cnblogs.com/yuanjia8888/p/13452832.html
Copyright © 2011-2022 走看看