Jumpserver中安装httpx

  1. 查看已安装的包
pip freeze
# python -V
# Python 2.7.5
  1. 安装anyio

刚开始直接pip install httpx,未设置版本号,因已有idna==2.7,所以出现版本不兼容的现象

anyio 3.0.0 requires idna>=2.8, but you have idna 2.7 which is incompatible.

尝试过后,选择anyio==1.3.0

pip install anyio==1.3.0

在这里插入图片描述

  1. 安装httpcore

    httpcore 0.13.7 requires anyio==3.*, but you have anyio 1.3.0 which is incompatible.

    httpx 0.18.0 requires httpcore<0.14.0,>=0.13.0, but you have httpcore 0.10.0 which is incompatible.

设置httpcore==0.13.0

pip install httpcore==0.13.0

在这里插入图片描述

  1. 安装httpx
pip install httpx==0.18.0

在这里插入图片描述

  1. 安装httpx[http]

在本地未安装这个包,程序就能运行,在jumpserver中不安装时出现以下错误

Using http2=True, but the 'h2' package is not installed. Make sure to install httpx using `pip install httpx[http2]`.
pip install httpx[http2]

在这里插入图片描述

  • 11
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
安装httpx模块,你可以使用pip命令。在命令行输入以下命令即可安装httpx模块: ``` pip install httpx ``` 安装完成后,你就可以在Python代码导入httpx模块并使用它了。例如,你可以使用以下代码导入httpx模块并发送GET请求: ```python import httpx url = 'https://spa16.scrape.center/' headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 'referer': 'https://scrape.center/' } client = httpx.Client(http2=True) response = client.get(url, headers=headers) print(response.text) print(response.http_version) ``` 这段代码使用httpx发送了一个GET请求,并打印了响应的内容和使用的传输协议版本。\[1\]希望这可以帮助到你。 #### 引用[.reference_title] - *1* [安装httpx模块](https://blog.csdn.net/m0_61017055/article/details/122270143)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [Python httpx模块教程](https://blog.csdn.net/haloged/article/details/130452294)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Xい

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值