Skip to content

修改为兼容PY3 #13

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

修改为兼容PY3 #13

wants to merge 10 commits into from

Conversation

raptorz
Copy link

@raptorz raptorz commented Nov 13, 2015

Python3里字符串都是unicode,并且不支持reload(sys),整数都是int,没有long。
另外,在.gitignore里加上VIM的临时文件*.swp

@jeffkit
Copy link
Owner

jeffkit commented Nov 16, 2015

几个问题:

  • lambda s: (s.encode("utf-8") if isinstance(s, str) else s ) 这行代码对于中文字符串转换是出错的。str是否应该为unicode?
  • 新增的代码没有符合PEP8规范。
  • unicode的函数没有必要用于所有的参数,只有xml参数才可能会有中文需要特殊处理。

@raptorz
Copy link
Author

raptorz commented Dec 21, 2015

  • 这个已经改了,现在是只有在PY3的情况下才需要执行这句。PY3只有str类型,没有unicode类型,所以必须这样判断。
  • 已PEP8
  • 不是因为中文才需要转unicode,而是因为加密库只支持bytes类型,不支持unicode(PY2)/str(PY3)类型,所以必须用utf-8编码以后才能正常使用各加密函数
  • 除了支持PY3以外,其它的修改包括:增加单独的token管理,允许https验证配置,API增加发送模板消息功能

@qwIvan
Copy link

qwIvan commented Apr 17, 2018

多年后再来看,还是没有支持py3。。。

@jeffkit
Copy link
Owner

jeffkit commented Apr 17, 2018

@qwIvan 推荐使用wechatpy了。 我这个库没有更新。

@qwIvan
Copy link

qwIvan commented Apr 17, 2018

就是wechatpy太丑了,才过来看看。。。

@jeffkit
Copy link
Owner

jeffkit commented Apr 17, 2018

@qwIvan 我居然动了重新维护的念头。

@daimon99
Copy link

我觉的只支持python3都可以了。

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

Successfully merging this pull request may close these issues.

5 participants