Yannis1990
V2EX  ›  Python

新浪微博Python 模拟登录错误

By Yannis1990 at 2012 年 8 月 23 日 · 4681 次点击
req = urllib2.Request(url = AUTH_URL, data = urllib.urlencode(postdata), headers = headers)
resp = urllib2.urlopen(req)


这段代码在windows上OK,在Mac OSX下遇到如下错误:

<urlopen error [Errno 8] nodename nor servname provided, or not known>

求解
3 条回复  •  1970-01-01 08:00:00 +08:00
VYSE
   1
VYSE  
   2012 年 8 月 23 日
nodename nor servname provided 是DNS解析失败了吧?
手动解析下,再看下http_proxy
Yannis1990
   2
Yannis1990  
OP
   2012 年 8 月 23 日
@VYSE 能给出详细一点的方法嘛...谢谢~
lookhi
   3
lookhi  
   2012 年 8 月 23 日   ❤️ 1
看上去也像是DNS错误。可以本地装个DNS服务。
dnsmasq就不错
推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
© 2026 V2EX · 25ms · 3.9.8.5