• requests不支持 HTTP/2.0 httpx攻破!


    1. 安装

    pip3 install 'httpx[http2]'

    2. 测试

    import httpx
    client = httpx.Client(http2=True)
    
    response = client.get('https://spa16.scrape.center/')
    print(response.text)

    结果

    <!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><meta name=referrer content=no-referrer><link rel=icon href=/favicon.ico><title>Scrape | Book</title><link href=/css/chunk-50522e84.e4e1dae6.css rel=prefetch><link href=/css/chunk-f52d396c.4f574d24.css rel=prefetch><link href=/js/chunk-50522e84.6b3e24aa.js rel=prefetch><link href=/js/chunk-f52d396c.f8f41620.js rel=prefetch><link href=/css/app.ea9d802a.css rel=preload as=style><link href=/js/app.b93891e2.js rel=preload as=script><link href=/js/chunk-vendors.a02ff921.js rel=preload as=script><link href=/css/app.ea9d802a.css rel=stylesheet></head><body><noscript><strong>We're sorry but portal doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.a02ff921.js></script><script src=/js/app.b93891e2.js></script></body></html>

    完事!!

  • 相关阅读:
    48 个seo技巧,seo站长必知技巧
    如何提高网站排名经验分享
    SEO影响网站排名因素有哪些
    如何建立一个利于SEO的网站
    HTML 笔记之 HTML 元素的概念
    idea配置springboot项目记录
    课后作业(一)
    团队任务(一)
    团队任务(二)
    软工假期预习作业1
  • 原文地址:https://www.cnblogs.com/loren880898/p/14779677.html
Copyright © 2020-2023  润新知