import urllib.request import urllib.parse class Http: def get(self, url): html = urllib.request.urlopen(url).read().decode('utf-8') return html def post(self, url, data, cookie=''): data = urllib.parse.urlencode(data).encode('utf-8') req = urllib.request.Request(url, data) if cookie != None: req.add_header('cookie', cookie) res = urllib.request.urlopen(req) html = res.read().decode('utf-8') return html if __name__ == '__main__': url = 'http://www.oppo.cn/thread/thread/index.json?page=1&limit=21&uid=46344778' html = Http().get(url) print(html)
学习笔记(一) 根据发帖时间,删除相关帖子
最新推荐文章于 2024-03-10 16:14:43 发布
