12345678910111213141516171819202122232425 |
- #!/usr/bin/env python
- # -*- encoding: utf-8 -*-
- '''
- @Author : liuyuqi
- @Contact : liuyuqi.gov@msn.cn
- @Time : 2019/08/11 10:27:41
- @Version : 1.0
- @License : (C)Copyright 2019
- @Desc : 垃圾的 urllib.request
- 404 页面不存在,就错误!
- '''
- import urllib.request
- url_page = "http://blog.yoqi.me"
- data = {}
- try:
- req = urllib.request.Request(
- url=url_page, data=urllib.parse.urlencode(data).encode(encoding='UTF8'))
- with urllib.request.urlopen(req) as res:
- print("http res:", res)
- except Exception as err:
- print("error:", err)
|