py propterties reuqest.post
import traceback
class Properties(object):
def __init__(self, fileName):
self.fileName = fileName
self.properties = {}
def __getDict(self, strName, dictName, value):
if(strName.find('.') > 0):
k = strName.split('.')[0]
dictName.setdefault(k, {})
return self.__getDict(strName[len(k) + 1:], dictName[k], value)
else:
dictName[strName] = value
return
def getProperties(self):
pro_file = open(self.fileName, 'Ur', encoding='utf-8')
for line in pro_file.readlines():
line = line.strip().replace('\n', '')
if line.find("#") != -1:
line = line[0:line.find('#')]
if line.find('=') > 0:
strs = line.split('=')
strs[1] = line[len(strs[0]) + 1:]
self.__getDict(strs[0].strip(),
self.properties, strs[1].strip())
return self.properties
=============
import os
os.system("testAccountGrant.1.py")
os.system("testApointmentSubmit.1.py")
os.system("testMedicalMealDetail.1.py")
os.system("testNbYbtYYXinxi.1.py")
os.system("testQueryTbDicTjdcList.1.py")
os.system("testQueryTbDicTjxmList.1.py")
os.system("testGetPublicpharmacy.1.py")
os.system("pause")
===============
import os
import requests
import json
from Util import Properties
print('########[agreementSign]################ * start')
properties = Properties("./global.properties").getProperties()
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
'Accept': 'text/html;q=0.9,*/*;q=0.8,application/json, text/plain, */*',
# 'Accept': 'text/html;q=0.9,*/*;q=0.8',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
'Accept-Encoding': 'gzip',
'Connection': 'close',
# 'content-type': 'application/json;charset=utf-8',
'Referer': None # 注意如果依然不能抓取的话,这里可以设置抓取网站的host
}
def data1():
with open('./json/addRenewalInfo.1.json', encoding='utf-8') as json_file:
data = json.load(json_file)
return data
print("***执行接口>>>>>", properties['addRenewalInfo'], '\n【请求参数】', data1())
files = {'imgSign': ('1.jpg', open(
'C:\\Users\\Administrator\\Desktop\\imgs\\2.jpg', 'rb'), 'image/jpg'), 'xxx': ('1.jpg', open(
'C:\\Users\\Administrator\\Desktop\\imgs\\3.jpg', 'rb'), 'image/jpg')}
r1 = requests.post(properties['addRenewalInfo'],
data=data1(), files=files, headers=headers)
r1.encoding = 'utf-8'
print('【响应】', r1.text)
py propterties reuqest.post的更多相关文章
- python调用py中rar的路径问题。
1.python调用py,在py中的os.getcwd()获取的不是py的路径,可以通过os.path.split(os.path.realpath(__file__))[0]来获取py的路径. 2. ...
- Python导入其他文件中的.py文件 即模块
import sys sys.path.append("路径") import .py文件
- import renumber.py in pymol
cp renumber.py /usr/local/lib/python2.7/dist-packages/pymol import renumber or run /path/to/renumber ...
- python gettitle.py
#!/usr/bin/env python # coding=utf-8 import threading import requests import Queue import sys import ...
- 解决 odoo.py: error: option --addons-path: The addons-path 'local-addons/' does not seem to a be a valid Addons Directory!
情况说明 odoo源文件路径-/odoo-dev/odoo/: 我的模块插件路径 ~/odoo-dev/local-addons/my-module 在my-module中创建了__init__.py ...
- caffe机器学习自带图片分类器classify.py实现输出预测结果的概率及caffe的web_demo例子运行实例
caffe机器学习环境搭建及python接口编译参见我的上一篇博客:机器学习caffe环境搭建--redhat7.1和caffe的python接口编译 1.运行caffe图片分类器python接口 还 ...
- 【转】Windows下使用libsvm中的grid.py和easy.py进行参数调优
libsvm中有进行参数调优的工具grid.py和easy.py可以使用,这些工具可以帮助我们选择更好的参数,减少自己参数选优带来的烦扰. 所需工具:libsvm.gnuplot 本机环境:Windo ...
- MySqlNDB使用自带的ndb_setup.py安装集群
在用Mysql做集群时,使用Mysql的NDB版本更易于集群的扩展,稳定和数据的实时性. 我们可以使用Mysql自带的工具进行集群安装与管理:ndb_setup.py.位于Mysql的安装目录bin下 ...
- 将做好的py文件打包成模块,供别人安装调用
现在要将写完的3个py文件,打包. 步骤: 1.新建一个文件夹setup(名字随便取),在setup文件夹下,再新建一个文件夹financeapi. 2.将上面4个py文件拷贝至financeapi文 ...
随机推荐
- 使用JS与CSS3的翻转实现3D翻牌效果
之前我们有讨论过使用CSS3如何实现网页水平翻转的效果,而这次我们介绍的是翻转效果更深一层的应用——3D翻牌效果. 这里我们需要使用flip中轴翻转实现,又因为是3D效果,如果希望呈现一定的3D视角, ...
- 有了art-template,如有神助
<div class="form-group col-lg-12"> <label class="control-label col-lg-3 text ...
- nodejs项目安装ant design
1.确保安装好nodejs $ node --version v10.4.1 2.确保npm $ npm -v 6.1.0 3.安装 $ sudo npm install antd-init -g / ...
- 结合CRT与欧拉定理高阶幂求余
- AD10中创建材料清单(BOM表)
材料清单可以用来作为元件的采购清单,同时也可以用于查看PCB中的元件封装信息是否正确. 操作: Reports----->Bill of Materials
- 使用@JsonFormat引起的时间比正常时间慢8小时解决方法
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
- WIN7右键在目录当前打开命令行Cmd窗口
Win7系统大家习惯“Win+R”的组合键打开命令提示符. 2. 通常情况下,我们点击鼠标右键是没有命令行选项的.. 3.在桌面上先按住Shift键,然后鼠标右键,出现选项“在此处打开命令窗口(W)” ...
- 非递归遍历二叉树Java实现
2018-10-03 20:16:53 非递归遍历二叉树是使用堆栈来进行保存,个人推荐使用双while结构,完全按照遍历顺序来进行堆栈的操作,当然在前序和后序的遍历过程中还有其他的压栈流程. 一.Bi ...
- PHP数组排序函数有哪些
PHP数组排序函数有哪些 一.总结 一句话总结:其实也就是是否保持索引,对键排序还是对值排序,除了sort,rsort.shuffle,usort外,都是保持索引的 是否保持索引 键排序 值排序 除了 ...
- php如何控制客户端生成缓存
php如何控制客户端生成缓存 一.总结 一句话总结:用http消息响应头中的Cache-Control来控制客户端缓存,说的是页面本身被客户端缓存,而不是重新生成的其它的非页面缓存 响应头Cache- ...