首页
关于
留言
友联
壁纸
统计
Search
1
python 爬虫
21 阅读
2
nas内网穿透
20 阅读
3
js前端密码校验
19 阅读
4
python Django增删改查 快速体验
18 阅读
5
python 钉钉机器人推送消息
14 阅读
默认分类
前端
后端
其他
登录
Search
标签搜索
python
React
Django
爬虫
css
2c
累计撰写
19
篇文章
累计收到
12
条评论
首页
栏目
默认分类
前端
后端
其他
页面
关于
留言
友联
壁纸
统计
搜索到
19
篇与
的结果
2022-04-28
python 钉钉机器人推送消息
import requests import time import hmac import hashlib import base64 import urllib.parse timestamp = str(round(time.time() * 1000)) secret = 'this is secret' secret_enc = secret.encode('utf-8') string_to_sign = '{}\n{}'.format(timestamp, secret) string_to_sign_enc = string_to_sign.encode('utf-8') hmac_code = hmac.new(secret_enc,string_to_sign_enc,digestmod=hashlib.sha256).digest() sign = urllib.parse.quote_plus(base64.b64encode(hmac_code)) access_token = '' url = 'https://oapi.dingtalk.com/robot/send?access_token={}×tamp={}&sign={}'.format(access_token,timestamp, sign) # 获取当前时间 str_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) # 发送的消息格式 data = {"msgtype": "markdown", "markdown": { "title": "测试已完成", "text":"啦啦啦", }, "at": {"atMobiles": ["15386174586"]} } headers = {'Content-Type': 'application/json'} message = requests.post(url, json.dumps(data), headers=headers).json()
2022年04月28日
14 阅读
0 评论
0 点赞
2022-04-28
DJango 邮件发送
settings# 邮箱配置 EMAIL_HOST = 'smtp.qq.com' EMAIL_PORT = 25 #发件箱的smtp服务器端口 EMAIL_HOST_USER = 'xxx@qq.com' # 你的 QQ 账号 EMAIL_HOST_PASSWORD = '秘钥' EMAIL_USE_TLS = True # 这里必须是 True,否则发送不成功 EMAIL_FROM = 'xxx@qq.com' # 你的 QQ 账号view.py # 导入django内置发送邮件包 from django.core.mail import send_mail email_title = '后台管理系统' email_body = '登录成功!' email = 'xxxx@qq.com' # 对方的邮箱 send_status = send_mail(email_title, email_body, EMAIL_FROM, [email])
2022年04月28日
9 阅读
0 评论
0 点赞
2022-04-28
react页面滚动监控(hooks,componentDidMount)
componentDidMount声明周期版本import React, { Component } from 'react' interface Props { } interface State { } export default class index extends Component<Props, State> { state = {} render() { return ( <div> </div> ) } componentDidMount(){ window.addEventListener('scroll', this.handleScroll); } handleScroll(){ console.log(window.scrollY) } } hooks版本 import React, { ReactElement, useEffect } from 'react' import './index.css' interface Props { } export default function Main({ }: Props): ReactElement { const [windowSize, setWindowSize] = React.useState({ width: 0, height: 0 }) const windowChange = () => { const width = window.scrollX const height = window.scrollY setWindowSize({ width, height }) console.log(height) } useEffect(() => { windowChange() window.addEventListener('scroll', windowChange) return () => { window.removeEventListener('scroll', windowChange) } }, []) return ( <div className='maindiv'> Main </div> ) }
2022年04月28日
8 阅读
0 评论
0 点赞
2022-04-28
python 爬虫
python
2022年04月28日
21 阅读
4 评论
0 点赞
1
...
3
4