def get_user_agent():user_agent = { 1: "Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; Nexus S Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", 2: "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0a2) Gecko/20110622 Firefox/6.0a2", 3: "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.514.0 Safari/534.7"}
juzi_headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36', 'Cookie': 'acw_tc=781bad2415356833875868669e6b598e72ed9130bba25091d49514ad0eb03e; PHPSESSID=743qbg5driv4mmsi2c3gcq5of5', 'Referer': 'http://manage.radar.itjuzi.com/admin/report', "Content-Type": "application/json", "X-Requested-With": "XMLHttpRequest"}### 题目描述我在一个py 文件里面定义了一个方法,方法里面有2个 变量 一个user_agent 一个juzi.headers 我能直接from** import get_user_agent 这种
1 回答
莫回无
TA贡献1865条经验 获得超7个赞
你直接定义成类不行吗?
class get_user_agent()
然后这样调
from xxx import get_user_agent
get_user_agent.user_agent
get_user_agent.juzi_headers
添加回答
举报
0/150
提交
取消