Skip to content

Commit 2a7885a

Browse files
authored
Merge pull request #367 from qiniu/open-python
修复travis CI挂了的问题,并接入了codecov
2 parents a5022fe + aeab3c7 commit 2a7885a

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

.travis.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
11
sudo: false
22
language: python
33
python:
4-
- 2.6.9
5-
- '2.7'
6-
- '3.4'
7-
- '3.5'
4+
- "2.7"
5+
- "3.4"
6+
- "3.5"
87
install:
98
- pip install flake8
109
- pip install pytest
1110
- pip install pytest-cov
1211
- pip install requests
1312
- pip install scrutinizer-ocular
13+
- pip install codecov
14+
1415
before_script:
1516
- export QINIU_TEST_BUCKET="pythonsdk"
1617
- export QINIU_TEST_DOMAIN="pythonsdk.qiniudn.com"
1718
- export QINIU_TEST_ENV="travis"
1819
- export PYTHONPATH="$PYTHONPATH:."
20+
1921
script:
20-
- if [[ "$TRAVIS_PYTHON_VERSION" != "2.6.9" ]]; then flake8 --show-source --max-line-length=160
21-
.; fi
22+
- if [[ "$TRAVIS_PYTHON_VERSION" != "2.6.9" ]]; then flake8 --show-source --max-line-length=160 .;
23+
fi
2224
- py.test --cov qiniu
2325
- if [[ "$TRAVIS_PYTHON_VERSION" != "2.6.9" ]]; then ocular --data-file .coverage;
2426
fi
27+
- coverage run test_qiniu.py
2528

2629
env:
2730
global:
28-
secure: McZuxM4UAKabtGvCi+t1F/Spb/3Yzb6O7hEk0JLwJEYCnl7hkfV1ogAgjjYdHwkNPjOwUaz3rpdmahz64ohtpucPsIyQjgK7tigTM+UgdAcg77RflB50yJ3yCnJOHMxVRF0RNLZqFeuf3GkfnOyzZFynN+LmM5n+0/iIuC4LXgs=
29-
QINIU_ACCESS_KEY=vHg2e7nOh7Jsucv2Azr5FH6omPgX22zoJRWa0FN5
31+
- secure: "McZuxM4UAKabtGvCi+t1F/Spb/3Yzb6O7hEk0JLwJEYCnl7hkfV1ogAgjjYdHwkNPjOwUaz3rpdmahz64ohtpucPsIyQjgK7tigTM+UgdAcg77RflB50yJ3yCnJOHMxVRF0RNLZqFeuf3GkfnOyzZFynN+LmM5n+0/iIuC4LXgs="
32+
- QINIU_ACCESS_KEY=vHg2e7nOh7Jsucv2Azr5FH6omPgX22zoJRWa0FN5
33+
34+
after_success:
35+
- codecov

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
[![@qiniu on weibo](http://img.shields.io/badge/weibo-%40qiniutek-blue.svg)](http://weibo.com/qiniutek)
44
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
55
[![Build Status](https://travis-ci.org/qiniu/python-sdk.svg)](https://travis-ci.org/qiniu/python-sdk)
6+
[![GitHub release](https://img.shields.io/github/v/tag/qiniu/python-sdk.svg?label=release)](https://github.com/qiniu/python-sdk/releases)
67
[![Latest Stable Version](https://img.shields.io/pypi/v/qiniu.svg)](https://pypi.python.org/pypi/qiniu)
78
[![Download Times](https://img.shields.io/pypi/dm/qiniu.svg)](https://pypi.python.org/pypi/qiniu)
89
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/qiniu/python-sdk/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/qiniu/python-sdk/?branch=master)
9-
[![Code Coverage](https://scrutinizer-ci.com/g/qiniu/python-sdk/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/qiniu/python-sdk/?branch=master)
10+
[![Coverage Status](https://codecov.io/gh/qiniu/python-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/qiniu/python-sdk)
11+
1012
## 安装
1113

1214
通过pip
@@ -19,8 +21,8 @@ $ pip install qiniu
1921

2022
| Qiniu SDK版本 | Python 版本 |
2123
|:--------------------:|:---------------------------:|
22-
| 7.x | 2.6, 2.7, 3.3, 3.4, 3.5|
23-
| 6.x | 2.6, 2.7 |
24+
| 7.x | 2.7, 3.3, 3.4, 3.5|
25+
| 6.x | 2.7 |
2426

2527
## 使用方法
2628

examples/sms_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
from qiniu import QiniuMacAuth
55
from qiniu import Sms
6+
import os
67

7-
8-
access_key = ''
9-
secret_key = ''
8+
access_key = os.getenv('QINIU_ACCESS_KEY')
9+
secret_key = os.getenv('QINIU_SECRET_KEY')
1010

1111
# 初始化Auth状态
1212
q = QiniuMacAuth(access_key, secret_key)

qiniu/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def token_of_request(
264264
data += "\n"
265265

266266
if content_type and content_type != "application/octet-stream" and body:
267-
if isinstance(body,bytes):
267+
if isinstance(body, bytes):
268268
data += body.decode(encoding='UTF-8')
269269
else:
270270
data += body

test_qiniu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ class DownloadTestCase(unittest.TestCase):
413413
def test_private_url(self):
414414
private_bucket = 'private-res'
415415
private_key = 'gogopher.jpg'
416-
base_url = 'http://%s/%s' % (private_bucket + '.qiniudn.com', private_key)
416+
base_url = 'http://%s/%s' % (private_bucket + '.qiniupkg.com', private_key)
417417
private_url = self.q.private_download_url(base_url, expires=3600)
418418
print(private_url)
419419
r = requests.get(private_url)

0 commit comments

Comments
 (0)