Created
April 6, 2024 14:13
-
-
Save BlueSkyXN/d4dba2e1a94e1332542d0a017816e19b to your computer and use it in GitHub Desktop.
tmp-img-api-haiduiyanxuan.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import random | |
| from datetime import datetime | |
| import time | |
| # 文件路径 | |
| file_path = r"F:/Download/test.jpg" | |
| # 目标URL | |
| url = "https://api.weixinyanxuan.com/mall/api/img/upload" | |
| # 准备头部信息 | |
| headers = { | |
| "Accept": "application/json, text/plain, */*", | |
| "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7", | |
| "Accept-Locale": "74f286fa6150a508514e5c62068467e0", | |
| "Cache-Control": "no-cache", | |
| "Connection": "keep-alive", | |
| "DNT": "1", | |
| "Origin": "https://b.haiduiyanxuan.cn", | |
| "Pragma": "no-cache", | |
| "Referer": "https://b.haiduiyanxuan.cn/", | |
| "Sec-Fetch-Dest": "empty", | |
| "Sec-Fetch-Mode": "cors", | |
| "Sec-Fetch-Site": "cross-site", | |
| "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1", | |
| "x-forwarded-for": "6.6.6.6", | |
| "x-originating-ip": "6.6.6.6", | |
| "x-remote-addr": "6.6.6.6", | |
| "x-remote-ip": "6.6.6.6" | |
| } | |
| # 随机选择一个nonce值 | |
| nonce_values = ['WCLtScJD', 'WCLtScJD'] | |
| nonce = random.choice(nonce_values) | |
| # 获取当前的时间戳(以毫秒为单位) | |
| timestamp = int(time.time() * 1000) | |
| timestamp = 1712409843138 | |
| # 准备文件和其他表单数据 | |
| files = { | |
| 'file': ('screenshot-20240402-090436.png', open(file_path, 'rb'), 'image/png') | |
| } | |
| data = { | |
| 'nonce': nonce, | |
| 'timestamp': str(timestamp) | |
| } | |
| # 发送POST请求 | |
| response = requests.post(url, headers=headers, files=files, data=data) | |
| # 打印响应内容 | |
| print(response.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment