unirest是否支持python3?

Nic*_*sis 1 python-3.x unirest

unirest是否支持python3?我用谷歌搜索,零信息出现。即使在unirest文档中也没有说仅是2.x,这使我相信它同时支持3.x和2.x。但是,安装将以3.4失败,并以2.7成功。见下文。

nkltss:~/dev$ mkvirtualenv mashape -p /usr/bin/python3
Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in mashape/bin/python3
Also creating executable in mashape/bin/python
Installing setuptools, pip...done.


(mashape)nkltss:~/dev$ pip install unirest
Downloading/unpacking unirest
  Downloading Unirest-1.1.6.tar.gz
  Running setup.py (path:/home/nick/.virtualenvs/mashape/build/unirest/setup.py) egg_info for package unirest

    warning: no files found matching '*.txt' under directory 'docs'
Downloading/unpacking poster>=0.8.1 (from unirest)
  Downloading poster-0.8.1.tar.gz
  Running setup.py (path:/home/nick/.virtualenvs/mashape/build/poster/setup.py) egg_info for package poster
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/home/nick/.virtualenvs/mashape/build/poster/setup.py", line 2, in <module>
        import poster
      File "/home/nick/.virtualenvs/mashape/build/poster/poster/__init__.py", line 29, in <module>
        import poster.streaminghttp
      File "/home/nick/.virtualenvs/mashape/build/poster/poster/streaminghttp.py", line 61
        print "send:", repr(value)
                    ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/home/nick/.virtualenvs/mashape/build/poster/setup.py", line 2, in <module>

    import poster

  File "/home/nick/.virtualenvs/mashape/build/poster/poster/__init__.py", line 29, in <module>

    import poster.streaminghttp

  File "/home/nick/.virtualenvs/mashape/build/poster/poster/streaminghttp.py", line 61

    print "send:", repr(value)

                ^

SyntaxError: invalid syntax

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/nick/.virtualenvs/mashape/build/poster
Storing debug log for failure in /home/nick/.pip/pip.log
Run Code Online (Sandbox Code Playgroud)

目前,我正在使用2.7,但我更喜欢将3.x用于新项目。

Mar*_*ers 6

该项目与Python 3不兼容。当项目没有明确说明这一点时(既不在setup.pytrove分类器中,也不在文档中),则您必须查看源代码。

我在那里找到:

该项目依赖于poster库,这也是urllib2特定的。

我会改用requests图书馆。它开箱即用地支持Python 3,除了异步请求外,它还支持相同的功能集(但更好的是,它没有urllib2带来缺点)。对于异步请求,您可以添加requests-futures。