> ## Documentation Index
> Fetch the complete documentation index at: https://help.decodo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Scrapy 代理中间件设置指南

<Steps>
  <Step>
    打开**终端**窗口。
  </Step>

  <Step>
    使用 `cd yourprojectname` 命令导航到项目文件夹的主目录。
  </Step>

  <Step>
    使用以下命令下载我们的代理中间件：

    <CodeGroup>
      ```shellscript cURL theme={null}
      curl https://raw.githubusercontent.com/decodo/Scrapy-Middleware/master/decodo_auth.py > decodo_auth.py
      ```
    </CodeGroup>
  </Step>

  <Step>
    现在您应该看到项目文件夹中包含 **decodo\_auth.py** 文件。
  </Step>

  <Step>
    使用文件管理器导航到项目文件夹，您应该会看到 **settings.py** 文件。
  </Step>

  <Step>
    使用您选择的编辑器编辑 **settings.py** 文件。
  </Step>

  <Step>
    在底部添加以下属性：

    <CodeGroup>
      ```text Properties theme={null}
      DOWNLOADER_MIDDLEWARES = {
          'scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware': 110,
          'yourprojectname.decodo_auth.ProxyMiddleware': 100,
      }

      DECODO_USER = 'username' ## Decodo 用户名（子用户）
      DECODO_PASSWORD = 'password' ## 您的用户密码
      DECODO_ENDPOINT = 'gate.decodo.com' ## 您想使用的端点
      DECODO_PORT = '7000' ## 您正在使用的端点的端口。
      ```
    </CodeGroup>

    <img src="https://mintcdn.com/decodo/7Hj3tfc-1rGMirwk/images/docs/cd46834789493a6759820c454d3209e711a6b8af411ec854ada5770d2f47731e-Group_427323124.png?fit=max&auto=format&n=7Hj3tfc-1rGMirwk&q=85&s=78495de100f6c804f3c31f74ff86784d" alt="" width="3448" height="1008" data-path="images/docs/cd46834789493a6759820c454d3209e711a6b8af411ec854ada5770d2f47731e-Group_427323124.png" />
  </Step>

  <Step>
    在 **DOWNLOADER\_MIDDLEWARES** 部分，将 `yourprojectname` 行更改为您的项目名称。

    <img src="https://mintcdn.com/decodo/7Hj3tfc-1rGMirwk/images/docs/c30e3a9994ad7ca781e40ae601b00e3c2925729547cfdb08a1450131c77723d8-Group_427323125.png?fit=max&auto=format&n=7Hj3tfc-1rGMirwk&q=85&s=385fe5ccaf04132356c066d88800bc1d" alt="" width="3448" height="1048" data-path="images/docs/c30e3a9994ad7ca781e40ae601b00e3c2925729547cfdb08a1450131c77723d8-Group_427323125.png" />
  </Step>

  <Step>
    确保在引号 **' '** 内输入您的账户详细信息以及代理详细信息。
  </Step>

  <Step>
    最后，**保存**文件。
  </Step>
</Steps>

<Note>
  要查找有关设置的更多信息，请务必访问我们的 [**Github 页面**](https://github.com/decodo/Scrapy-Middleware)。如果您希望在请求中直接使用 Decodo，请参阅[**此文章**](https://github.com/decodo/Scrapy)。
</Note>

***

<Columns cols={2}>
  <Card title="支持" href="https://direct.lc.chat/12092754" cta="让我们聊聊！">
    需要帮助或只是想打个招呼？我们的支持团队全天候为您服务。 \
    您也可以随时通过电子邮件 [support@decodo.com](mailto:support@decodo.com) 联系我们。
  </Card>

  <Card title="反馈" href="mailto:feedback@decodo.com" cta="分享反馈">
    找不到您要找的内容？请求一篇文章！ \
    有反馈意见？分享您对我们如何改进的想法。
  </Card>
</Columns>
