Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
android-package
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周烽
android-package
Commits
7d79ffe4
Commit
7d79ffe4
authored
Dec 11, 2018
by
周烽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
线上改用oss sdk上传
parent
e7eff1d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
9 deletions
+20
-9
package.py
package.py
+20
-9
No files found.
package.py
View file @
7d79ffe4
...
@@ -2,6 +2,7 @@ import os
...
@@ -2,6 +2,7 @@ import os
import
sys
import
sys
import
pexpect
import
pexpect
import
requests
import
requests
import
oss2
enviorments
=
[
"debug"
,
"intranettest"
,
"outnettest"
,
"preonline"
,
"release"
]
enviorments
=
[
"debug"
,
"intranettest"
,
"outnettest"
,
"preonline"
,
"release"
]
...
@@ -111,20 +112,30 @@ if __name__ == '__main__':
...
@@ -111,20 +112,30 @@ if __name__ == '__main__':
files
=
{
'file'
:
open
(
apk_path
,
'rb'
)}
files
=
{
'file'
:
open
(
apk_path
,
'rb'
)}
if
environment
==
'release'
or
environment
==
'Release'
:
if
environment
==
'release'
or
environment
==
'Release'
:
url
=
prod_upload_url
#正式包用oss sdk上传,测试环境以后再改吧
# 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录 https://ram.console.aliyun.com 创建RAM账号。
auth
=
oss2
.
Auth
(
'LTAIucWV0jw5aDqx'
,
'qciWJMku6OSsdgipcDvQTGyaG3uCaj'
)
# Endpoint以杭州为例,其它Region请按实际情况填写。
bucket
=
oss2
.
Bucket
(
auth
,
'http://oss-cn-hangzhou.aliyuncs.com'
,
'quwen'
)
# <yourLocalFile>由本地文件路径加文件名包括后缀组成,例如/users/local/myfile.txt
bucket
.
put_object_from_file
(
oss_dir
+
"/"
+
apk_name
,
apk_path
)
# 返回下载链接
os
.
system
(
"echo "
+
"https://m.tuipine.com/"
+
oss_dir
+
"/"
+
apk_name
)
else
:
else
:
url
=
test_upload_url
url
=
test_upload_url
response
=
requests
.
post
(
url
,
data
=
data
,
files
=
files
)
response
=
requests
.
post
(
url
,
data
=
data
,
files
=
files
)
download_url
=
response
.
text
download_url
=
response
.
text
if
"http"
in
download_url
:
if
"http"
in
download_url
:
success
=
True
success
=
True
else
:
else
:
success
=
False
success
=
False
# 返回下载链接
os
.
system
(
"echo "
+
response
.
text
)
# 将文件放到下载服务器下
# 将文件放到下载服务器下
command
=
"sudo cp "
+
apk_path
+
" "
+
download_path
+
apk_name
command
=
"sudo cp "
+
apk_path
+
" "
+
download_path
+
apk_name
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment