37,743
社区成员




def post(title, keyboard, writer, newstime, downurl_qz, downpath, softsay, msmallpic, mbigpic, newstext, catid):
query = "http://localhost/e/admin/jiekou.php?pw=123456"
data_form = {
"enews": "AddNews",
"classid": catid, # 栏目id
"bclassid": 0, # 父栏目id
"id": 0,
"filepass": int(time.time()), # 发布文章的时间戳
"username": "admin",
"oldfilename":"",
"oldgroupid":"",
"oldchecked": 1,
"newstext_url":"",
"ecmsfrom":'http://localhost/e/admin/ListNews.php?classid=3',
"fstb":"",
"oldttid":"",
"ecmsnfrom": 1,
"ecmscheck": 0,
"havetmpic": 0,
"title": title,
"keyboard": keyboard,
"softwriter": writer,
"softtype": "",
"downurl_qz": downurl_qz,
"downname[]": "下载地址1",
"downpath[]": downpath,
"softsay": softsay,
"msmallpic[]": msmallpic,
"mbigpic[]": mbigpic,
"newstext": newstext,
"dokey": 1,
"autosize": 5000,
"infotags": keyboard,
"newstime": newstime,
"checked": 1,
"isgood": 0,
"firsttitle": 0,
"writer": "admin",
"befrom": "",
"dokey": 1,
"copyimg": 1,
"autosize": 5000,
"istop": 0,
"newstempid": 0,
"groupid": 0,
"userfen": 0,
"onclick": 0,
"totaldown": 0,
"addnews": "提 交",
}
print(type(data_form))
data = urllib.parse.urlencode(data_form).encode(encoding='utf-8')
req = urllib.request.Request(query, data=data)
res = urllib.request.urlopen(req, timeout=10)
# result = res.read().decode('utf-8')
print("已发布成功")