• 使用 flask和redis维护 代理池


    https://github.com/germey/proxypool

    该模块 使用是 直接 在 ubuntu上部署  安装 需要 python大于3.5.2使用aiohttp

    root@iZ2ze88rg4xz5qs8lcjjd4Z:~# which pip3.6
    root@iZ2ze88rg4xz5qs8lcjjd4Z:~# ln -s /usr/local/python3.6/bin/pip3.6 /usr/bin/pip3.6
    root@iZ2ze88rg4xz5qs8lcjjd4Z:~# which pip3.6
    /usr/bin/pip3.6

    上面是创建 安装好的pip的链接

    1.下载

    cd mkdir code git init git clone https://github.com/germey/proxypool cd proxypool

    2.安装 pip3.6 install -r requirements.txt

    3. python3.6 run.py

    root@iZ2ze88rg4xz5qs8lcjjd4Z:/code/proxypool/ProxyPool# python3.6 run.py
    Traceback (most recent call last):
    File "run.py", line 1, in <module>
    from proxypool.api import app
    File "/code/proxypool/ProxyPool/proxypool/api.py", line 1, in <module>
    from flask import Flask, g
    File "/usr/local/python3.6/lib/python3.6/site-packages/flask/__init__.py", line 21, in <module>
    from .app import Flask, Request, Response
    File "/usr/local/python3.6/lib/python3.6/site-packages/flask/app.py", line 25, in <module>
    from . import cli, json
    File "/usr/local/python3.6/lib/python3.6/site-packages/flask/cli.py", line 18, in <module>
    import ssl
    File "/usr/local/python3.6/lib/python3.6/ssl.py", line 101, in <module>
    import _ssl # if we can't import it, let the error propagate
    ModuleNotFoundError: No module named '_ssl'
    root@iZ2ze88rg4xz5qs8lcjjd4Z:/code/proxypool/ProxyPool# pip3.6 install ssl
    Collecting ssl
    Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/83/21/f469c9923235f8c36d5fd5334ed11e2681abad7e0032c5aba964dcaf9bbb/ssl-1.16.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-sf7597gx/ssl/setup.py", line 33
    print 'looking for', f
    ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print('looking for', f)?

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-sf7597gx/ssl/

    简单点说就是 少了 ssl 但是 直接pip安装无法实现

    1.安装ssl
    sudo apt-get install openssl

    sudo apt-get install libssl-dev

    2. 修改Moudles/Setup (该目录在python的解压目录下)

    vim Modules/Setup
    #修改结果如下:
    # Socket module helper for socket(2)
    _socket socketmodule.c timemodule.c

    # Socket module helper for SSL support; you must comment out the other
    # socket line above, and possibly edit the SSL variable:
    #SSL=/usr/local/ssl
    _ssl _ssl.c
    -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl
    -L$(SSL)/lib -lssl -lcrypto


    3.重新安装一次 这里和上面 一个一致 https://www.cnblogs.com/billhsu2009/p/9958515.html

    ./configure --prefix=/usr/local/python3.6

    make

    make install


    4.python3

    ---------------------
    参考 https://blog.csdn.net/zr1076311296/article/details/75136612

    5 切入 python3.6 import ssl ok

    6 重新运行 

    需要安装 fake_useragent 直接pip安装就ok

    File "/usr/local/python3.6/lib/python3.6/site-packages/redis/client.py", line 668, in execute_command
    return self.parse_response(connection, command_name, **options)
    File "/usr/local/python3.6/lib/python3.6/site-packages/redis/client.py", line 680, in parse_response
    response = connection.read_response()
    File "/usr/local/python3.6/lib/python3.6/site-packages/redis/connection.py", line 629, in read_response
    raise response
    redis.exceptions.ResponseError: NOAUTH Authentication required.

    https://github.com/WiseDoge/ProxyPool

    https://github.com/germey/proxypool

  • 相关阅读:
    【题解】 bzoj2748 [HAOI2012]音量调节 (动态规划)
    【题解】 bzoj1190: [HNOI2007]梦幻岛宝珠 (动态规划)
    【题解】 bzoj1864: [Zjoi2006]三色二叉树 (动态规划)
    【题解】 [ZJOI2006]书架 (Splay)
    【题解】 [HNOI2004]宠物收养场(Splay)
    【题解】 [HNOI2002]营业额统计 (Splay)
    【题解】 [ZJOI2008] 泡泡堂(贪心/二分图/动态规划)
    【题解】 [SDOI2009] Elaxia的路线(最短路+拓扑排序)
    Aptana Studio 3 如何汉化,实现简体中文版
    js中获得当前时间是年份和月份
  • 原文地址:https://www.cnblogs.com/billhsu2009/p/9958790.html
Copyright © 2020-2023  润新知