Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] AttributeError: 'URLError' object has no attribute 'read' #7

Closed
ghost opened this issue Jun 13, 2014 · 5 comments
Closed

[bug] AttributeError: 'URLError' object has no attribute 'read' #7

ghost opened this issue Jun 13, 2014 · 5 comments

Comments

@ghost
Copy link

ghost commented Jun 13, 2014

jpush/push.py ? in send_notification_by_registrationid

        self._send_msg(params)
jpush/push.py ? in _send_msg

        try:
             api_post = urllib2.urlopen(data=urllib.urlencode(params),
                                        url=API_URL, timeout=5)
             print api_post.read()
         except Exception, e:
             print e, e.read()
     #Deprecated"
     def send_notification_by_imei(self, imei, app_key, sendno, senddes,
                                   msg_title, msg_content, platform, extras={}):
         """Send notification by imei"""
'e' 
URLError(timeout('timed out',),)

jpush/push.py 第68行

@hupantingxue
Copy link
Contributor

Please check your network,thx.

@ghost
Copy link
Author

ghost commented Jun 21, 2014

@javenfang

我上面的日志少贴了一行可能你没看明白。我说的那个异常是由timeout引起的,错误的代码在这里:https://github.com/jpush/jpush-api-python-client/blob/v2.1.0/jpush/push.py#L68
e.read() 的时候报错,因为e对象并没有read()这个方法。

代码本来是要去捕捉timeout这个异常,但是却产生了新的异常。

@hupantingxue
Copy link
Contributor

ok,thx!
I had fixed the issue, you can update the code from tag 'v2.1.0'
Thanks for you reporting the issue!

@roots01
Copy link

roots01 commented Aug 28, 2015

How to solve this problem? I also have this problem.

@hupantingxue
Copy link
Contributor

@roots01 更新最新版本即可。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants