当前位置:网站首页>Guangcheng cloud service can fill in a daily report regularly every day
Guangcheng cloud service can fill in a daily report regularly every day
2022-04-23 02:53:00 【Little fat man who loves bug】
be based on python Realize the daily report
The school applet has been updated , So our code needs to be changed a little . I'll grab the bag again , First open our Charles, Open the Guangcheng cloud service that will share us with the file transfer assistant .

Through some text information, we can know that this is our small program that needs to capture packets . This time, the small program of the school has been greatly changed , The domain names have been changed . But for us, it doesn't affect , The principle is the same .
The principle of automatic filling is to simulate normal users sending data packets to their background data . The web page that our normal users visit is through get Request to get data , and , We submit data with post request , What we're going to do is use post Request to send form data . If we try to submit data once, we will see a URL Pop it out .

This packet , Contains the form data we need to submit , also URL( Commonly known as link ).
My source code has been written
# -*- coding: utf8 -*-
import requests
import json
# You can change it to your own token
token = "8966a1aa7508438fa384fc02767d5835"
studentinfo = {
"version": "20220409",
"name": " handsome young man ",# Fill in the name
"pwd": "12345678",# Fill in the student number
"openid": "openid",
"subscription": "accept"
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat"
}
def getuid(info):
login_url = "https://jsd.hc-web.cn/api/index/login"
return int(json.loads(requests.post(login_url, info, verify=False, headers=headers).text)["data"]["user"]["id"])
def putdata(uid):
put_url = "https://jsd.hc-web.cn/api/index/putDay"
data = {
"version": 20220409,
"uid": uid,
"is_campus": " no ",
"campus": " Internship abroad without returning to school ",
"nowaddress": " Currently in Guangzhou ",
"nowaddressinfo": "undefined",
"region_address": "undefined",
"phone": "15218128768",
"fever": 2,
"feverinfo": "undefined",
"feverinfo1": "undefined",
"feverinfo2": "undefined",
"feverinfo3": "undefined",
"jie": "5",
"jie1": "undefined",
"jie3": "undefined",
"jie4": "undefined",
"jie5": "undefined",
"jie6": "undefined",
"jie7": "undefined",
"jie8": "undefined",
"jie9": "undefined",
"jie10": "undefined",
"jie11": "undefined",
"plan": 2,
"planaddress": "undefined",
"risk_area": " Low risk areas ",
"risk_area_address": "undefined",
"jkcode": " Green code ",
"new_status": " At home ",
"status_remark": " Online practice ",
"company" :"undefined",
"city":"undefined",
"other_status":"undefined",
}
response = json.loads(requests.post(put_url, data, verify=False).text)
result = True if response["msg"] == " Saved successfully " else False
return result
def server_push(result):
push_url = "http://www.pushplus.plus/send?"
title = " Yes , The daily report has been completed " if result == True else " Mama ah , The daily newspaper failed "
oneyan = "<p>" + requests.get("https://v1.hitokoto.cn/?c=f&encode=text", verify=False).text + "</p>";
data = {
"token": token,
"title": title,
"content": oneyan + '',
"template": "html"
}
response = json.loads(requests.post(push_url, data, verify=False, headers=headers).text)
print(response)
def run():
if token == "":
putdata(getuid(studentinfo))
return " A daily report of success , However, wechat notification push has not been started !"
else:
server_push(putdata(getuid(studentinfo)))
return " A daily report of success , Wechat notification has been pushed !"
def main_handler(event, context):
return run()
# if __name__ == '__main__':
# run()
Use Tencent cloud function to realize daily automatic filling
If you don't apply for Tencent cloud account here, you can apply for one , Baidu cloud is OK , I use Tencent cloud for demonstration here ( It's all free ). Click on the top right console -- Select the cloud product in the upper left corner -- Select cloud function .

Here we choose to create -- Choose to start from scratch (helloworld Templates )-- Operating environment selection python3.6 edition . Delete the code inside , Copy and paste the code above .
Next is the most important link , Trigger . We need to be regular every day 10 Click trigger to run the program .

Select custom trigger , Here we can't choose the ten point trigger program to run , We also customize a .

Cron The expression means every day 10 Click to trigger a program run , In this way, our program can run regularly every day .
Click deploy and test , Success proves that the code is OK , That's pretty much it .
Here's another little detail , Namely token, The purpose is to tell us whether the program runs successfully or fails . Failure proves that their data has been updated . Use token It's also very simple. , Focus on one pushplus Push plus A public of , Log in . Click profile , Find the development settings . There's yours in it token, You can also set up one yourself . In this way, once the program runs, your mobile phone will receive a message . The effect is as follows :


版权声明
本文为[Little fat man who loves bug]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220715077016.html
边栏推荐
- Devil cold rice 𞓜 078 devil answers the market in Shanghai and Nanjing; Communication and guidance; Winning the country and killing and screening; The purpose of making money; Change other people's op
- [hcip] detailed explanation of six LSAS commonly used by OSPF
- 【工欲善其事必先利其器】论文编辑及文献管理(Endnote,Latex,JabRef ,overleaf)资源下载及使用指南
- Interpretation of the future development of smart agriculture
- Shell script learning notes - regular expressions
- 魔王冷饭||#078 魔王答上海、南京行情;沟通指导;得国和打杀筛选;赚钱的目的;改变别人看法
- Looking for a job, writing a resume to an interview, this set of information is enough!
- Classification of technology selection (2022)
- The second day of learning rhcsa
- Android high-level interview must ask: overall business and project architecture design and reconstruction
猜你喜欢

How big the program development of single chip microcomputer project can be, it represents your level of knocking code

C语言 171. 最近回文数

期中汇总(概论+应用层+运输层)

接口请求时间太长,jstack观察锁持有情况

Actual combat of industrial defect detection project (IV) -- ceramic defect detection based on hrnet

Liunx foundation - zabbix5 0 monitoring system installation and deployment

Encapsulation of ele table

ROP Emporium x86_ 64 7 ~ 8 questions

基于Scrum进行创新和管理

Airtrack cracking wireless network password (Dictionary running method)
随机推荐
Flink stream processing engine system learning (I)
Shell script learning -- practical case
First day of rhcsa
Step principle of logical regression in machine learning
What is the difference between varchar and char?
Centos7 install MySQL 8 0
Innovation and management based on Scrum
Servlet template engine usage example
Renesas electronic MCU RT thread development and Design Competition
【Hcip】OSPF常用的6种LSA详解
OCR recognition PDF file
Day 4 of learning rhcsa
grain rain
基于ele封装下拉菜单等组件
Chapter VI project information management system summary
Linux Redis——Redis 数据库缓存服务
Cuisine leetcode
Intelligent agricultural management model
Actual combat of industrial defect detection project (IV) -- ceramic defect detection based on hrnet
JZ35 replication of complex linked list