Skip to content

Instantly share code, notes, and snippets.

@zxyle
Last active June 23, 2018 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zxyle/73194deda4fb3729107f17430521c31c to your computer and use it in GitHub Desktop.
Save zxyle/73194deda4fb3729107f17430521c31c to your computer and use it in GitHub Desktop.
云海服务商自动发货
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Zheng <me@zxyle.cn>
# Desc: 云海-自动发货
import time
import base64
from hashlib import md5
import requests
# 卖家旺旺
wangwang = ""
# 云海后台 自定义的密码
password = ""
sign = str(base64.b64encode(md5(password.encode('utf-8')).digest()), encoding='utf-8')
headers = {
"Proxy-Connection": "keep-alive",
"Accept": "*/*",
"X-Requested-With": "XMLHttpRequest",
"User-Agent": "SpaceTimeApp2.0",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Accept-Language": "zh-CN,en-US;q=0.8",
}
# 获取订单
order_url = "http://api.yunhaike.com/api/trade/executeTidSend"
order_data = {
"tid": "",
"sellerWang": wangwang,
"sign": sign,
"timestamp": int(time.time())
}
order_response = requests.post(order_url, data=order_data, headers=headers)
print(order_response.text)
# 发货
url = "http://api.yunhaike.com/api/trade/executeTidSend"
data = {
"tid": "",
"sellerWang": wangwang,
"sign": sign,
"timestamp": int(time.time())
}
response = requests.post(url, data=data, headers=headers)
print(response.text)
# 更改发货状态
update_url = "http://api.yunhaike.com/api/trade/LogisticsDummySend"
update_data = {
"tid": "",
"sellerWang": wangwang,
"sign": sign,
"timestamp": int(time.time())
}
resp = requests.post(update_url, data=update_data, headers=headers)
print(resp.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment