1 Star 0 Fork 0

wbyang / postfile

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
postFile.py 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
#! usr/bin/python
#coding=utf-8
import sys
import requests
if __name__ == '__main__':
if len(sys.argv)!= 2:
sys.exit('argv error!')
#filepath = sys.argv[1]
posturl='http://xxx/Home/PostFile' #测试环境
#posturl='http://xxx/Home/PostFile' #预发布
filepath = sys.argv[1]
webOrAdmin = ''
relativePath = ''
ext = ''
print filepath
if "\\Jwell.Web\\" in filepath:
print 'web'
webOrAdmin = 'web'
if "\\Jwell.Admin\\" in filepath:
print 'admin'
webOrAdmin = 'admin'
if webOrAdmin == '':
sys.exit('webOrAdmin error!')
if webOrAdmin == 'web':
relativePath = filepath[filepath.index("\\Jwell.Web\\")+10:]
print relativePath
if webOrAdmin == 'admin':
relativePath = filepath[filepath.index("\\Jwell.Admin\\")+12:]
print relativePath
sys.exit('admin not support!')
ext = relativePath[relativePath.rindex('.')+1:]
print 'ext=' + ext
if ext in ['css','js','cshtml']:
content = open(filepath, "r").read()
print content
postdata = {'file': relativePath, 'content': content,'sign':'123'}
r = requests.post(posturl, data=postdata)
print r.text
str = raw_input("任意键退出: ")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/nxwsyang/postfile.git
git@gitee.com:nxwsyang/postfile.git
nxwsyang
postfile
postfile
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891