Giter VIP home page Giter VIP logo

pyrequests's Introduction

Pyrequests

一个简单https网络请求测试库,作为个人学习记录,暂不支持代理,如果你用过requests,它将会变得非常容易, 内置firefox34指纹.

安装依赖 requirement.txt

cryptography==36.0.1
pyOpenSSL==21.0.0

GET

>>> import pyrequests
>>> sess = pyrequests.HttpSession()
>>> r = sess.get('https://httpbin.org/get',headers={'User-Agent':'3301'},cookies={'k':'3301')
>>> r = sess.get('https://httpbin.org/get',headers={'User-Agent':'3301'},cookies='k=3301')
>>>r.status_code
200
>>> r.encoding
'utf-8'
>>> r.text
'{\n  "args": {}, ...
>>> r.json
{'args': {},...

如果你想知道原生http报文是否达到预期,你可以这样
>>> r.request.raw
b'GET /get HTTP/1.1\r\nHost: httpbin.org ...

POST

>>> r = sess.post('https://httpbin.org/get',data={})
>>> r = sess.post('https://httpbin.org/get',json={})

相关功能支持

  • tls1.2
  • 密码套件TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b), TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)
  • http/1.1

关于pyrequests

时间充足的话,后面考虑添加代理,动态tls指纹,tls1.3,http2
有什么bug, 或者好设计模式, 欢迎大家issues
本人vx号: ZanCoder,如果感兴趣和我一起学习开发吧

pyrequests's People

Contributors

zero3301 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.