Skip to content

Commit f58d772

Browse files
committed
修改travis 配置
1 parent ec3e962 commit f58d772

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ python:
44
- '3.5'
55
install:
66
- pip install -r requirements.txt
7-
script: python test_example.py
7+
script: python tests/test_example.py
88
deploy:
99
provider: pypi
1010
user: goodspeed

example/wxapp_cloud_file.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
appid = environ.get("WXAPP_APPID", "appid")
88
secret = environ.get("WXAPP_SECRET", "secret")
9-
env = "test-id"
9+
env = environ.get("WXAPP_ENV", "test-id")
1010

1111
app_cloud = WxAppCloudAPI(
1212
appid=appid, app_secret=secret, grant_type="client_credential"
@@ -15,7 +15,11 @@
1515

1616
cloud_api = WxAppCloudAPI(access_token=token)
1717

18-
path = "test/file.py"
19-
filepath = "./file.py"
18+
path = "test/author.jpg"
19+
filepath = "/Users/gs/Desktop/author.jpg"
20+
path = "test/id2uid1.lua"
21+
filepath = "/Users/gs/Desktop/id2uid.lua"
22+
path = "test/aws-serverless-games.pdf"
23+
filepath = "/Users/gs/Desktop/aws-serverless-games.pdf"
2024
resp = cloud_api.upload_file(json_body={"env": env, "path": path, "filepath": filepath})
2125
print(resp)
File renamed without changes.

weixin/client.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -346,15 +346,15 @@ def upload_file(self, json_body=None):
346346
filepath = json_body.pop("filepath", None)
347347
pre_resp = self.pre_upload_file(json_body=json_body)
348348
if pre_resp.get("errcode") == 0 and pre_resp.get("errmsg") == "ok":
349-
files = {
350-
"key": json_body.get("path"),
351-
"Signature": pre_resp.get("authorization"),
352-
"x-cos-security-token": pre_resp.get("token"),
353-
"x-cos-meta-fileid": pre_resp.get("cos_file_id"),
354-
"file": file_data, # file 一定要放到最后,血泪的教训
355-
}
349+
files = [
350+
("key", json_body.get("path")),
351+
("x-cos-security-token", pre_resp.get("token")),
352+
("x-cos-meta-fileid", pre_resp.get("cos_file_id")),
353+
("Signature", pre_resp.get("authorization")),
354+
("file", file_data), # file 一定要放到最后,血泪的教训
355+
]
356356
# encode
357-
params = {smart_str(k): v for k, v in files.items()}
357+
params = [(smart_str(k), v) for k, v in files]
358358
resp = requests.post(pre_resp.get("url"), files=params)
359359
status_code = resp.status_code
360360
if status_code == 204:

0 commit comments

Comments
 (0)