-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
2,091 additions
and
404 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
on: [push] | ||
name: Run Test Cases | ||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 1 | ||
matrix: | ||
python_version: ['2.7', '3.4', '3.5', '3.6', '3.7', '3.8', '3.9'] | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.ref }} | ||
- name: Setup python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python_version }} | ||
architecture: x64 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest pytest-cov freezegun requests scrutinizer-ocular codecov | ||
- name: Run cases | ||
env: | ||
QINIU_ACCESS_KEY: ${{ secrets.QINIU_ACCESS_KEY }} | ||
QINIU_SECRET_KEY: ${{ secrets.QINIU_SECRET_KEY }} | ||
QINIU_TEST_BUCKET: ${{ secrets.QINIU_TEST_BUCKET }} | ||
QINIU_TEST_DOMAIN: ${{ secrets.QINIU_TEST_DOMAIN }} | ||
QINIU_TEST_ENV: "travis" | ||
PYTHONPATH: "$PYTHONPATH:." | ||
run: | | ||
set -e | ||
flake8 --show-source --max-line-length=160 . | ||
py.test --cov qiniu | ||
ocular --data-file .coverage | ||
coverage run test_qiniu.py | ||
codecov |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,3 +44,5 @@ nosetests.xml | |
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
/.idea | ||
/.venv |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"http:wxCLv4yl_5saIuOHbbZbkP-Ef3kFFFeCDYmwTdg3:upload30": {"upHosts": ["http://up.qiniu.com", "http://upload.qiniu.com", "-H up.qiniu.com http://183.131.7.3"], "ioHosts": ["http://iovip.qbox.me"], "deadline": 1598428478}} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
# flake8: noqa | ||
|
||
|
||
""" | ||
批量拷贝文件 | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# flake8: noqa | ||
|
||
""" | ||
批量删除文件 | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# flake8: noqa | ||
|
||
""" | ||
批量移动文件 | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# flake8: noqa | ||
|
||
""" | ||
批量重命名文件 | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
# flake8: noqa | ||
|
||
""" | ||
批量解冻文件 | ||
https://developer.qiniu.com/kodo/api/1250/batch | ||
""" | ||
|
||
from qiniu import build_batch_restoreAr, Auth, BucketManager | ||
|
||
# 七牛账号的公钥和私钥 | ||
access_key = '<access_key>' | ||
secret_key = '<secret_key>' | ||
|
||
q = Auth(access_key, secret_key) | ||
|
||
bucket = BucketManager(q) | ||
|
||
# 存储空间 | ||
bucket_name = "空间名" | ||
|
||
# 字典的键为需要解冻的文件,值为解冻有效期1-7 | ||
ops = build_batch_restoreAr(bucket_name, | ||
{"test00.png": 1, | ||
"test01.jpeg": 2, | ||
"test02.mp4": 3 | ||
} | ||
) | ||
|
||
ret, info = bucket.batch(ops) | ||
print(info) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# flake8: noqa | ||
|
||
from qiniu import Auth | ||
from qiniu import BucketManager | ||
|
||
""" | ||
获取空间绑定的加速域名 | ||
https://developer.qiniu.com/kodo/api/3949/get-the-bucket-space-domain | ||
""" | ||
|
||
# 七牛账号的 公钥和私钥 | ||
access_key = '<access_key>' | ||
secret_key = '<secret_key>' | ||
|
||
# 空间名 | ||
bucket_name = '' | ||
|
||
q = Auth(access_key, secret_key) | ||
|
||
bucket = BucketManager(q) | ||
|
||
ret, info = bucket.bucket_domain(bucket_name) | ||
print(info) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*- coding: utf-8 -*- | ||
# flake8: noqa | ||
|
||
from qiniu import Auth | ||
from qiniu import BucketManager | ||
|
||
# 需要填写你的 Access Key 和 Secret Key | ||
access_key = '' | ||
secret_key = '' | ||
|
||
# 空间名 | ||
bucket_name = 'bucket_name' | ||
|
||
q = Auth(access_key, secret_key) | ||
|
||
bucket = BucketManager(q) | ||
|
||
ret, info = bucket.bucket_info(bucket_name) | ||
print(info) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# flake8: noqa | ||
|
||
""" | ||
查询指定域名指定时间段内的带宽 | ||
""" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# flake8: noqa | ||
|
||
""" | ||
查询指定域名指定时间段内的流量 | ||
""" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# flake8: noqa | ||
|
||
""" | ||
获取指定域名指定时间内的日志链接 | ||
""" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
# flake8: noqa | ||
|
||
from qiniu import Auth | ||
from qiniu import BucketManager | ||
|
||
# 需要填写七牛账号的 公钥和私钥 | ||
access_key = '<access_key>' | ||
secret_key = '<secret_key>' | ||
|
||
# 空间名 | ||
bucket_name = "" | ||
|
||
# private 参数必须是str类型,0表示公有空间,1表示私有空间 | ||
private = "0" | ||
|
||
q = Auth(access_key, secret_key) | ||
|
||
bucket = BucketManager(q) | ||
|
||
ret, info = bucket.change_bucket_permission(bucket_name, private) | ||
print(info) |
Oops, something went wrong.