zoukankan      html  css  js  c++  java
  • 使用 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

  • 相关阅读:
    Kafka 集群搭建 (自用)
    Kafka 简单实验二(Python实现简单生产者消费者)
    Kafka 简单实验一(安装Kafka)
    Spark下载与入门(Spark自学二)
    Spark导论(Spark自学一)
    MongoDB分片集群新增分片(自用)
    Python 获取图片文件大小并转换为base64编码
    Python 获取图片格式及像素宽高信息
    MongoDB集群设置集合分片生效及查看集合分片情况
    商城购物车的实现设计思想
  • 原文地址:https://www.cnblogs.com/billhsu2009/p/9958790.html
Copyright © 2011-2022 走看看