wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.86k stars 240 forks source link

我看了你的demo,能mock响应体和响应头,但是怎么mockjson格式的响应体,我用json格式报错,只能用str #707

Open liweihaha opened 10 months ago

liweihaha commented 10 months ago

def interceptor(request): if request.url == 'https://www.baidu.com': request.create_response( status_code=200, headers={'Content-Type': 'application/json'}, # Optional headers dictionary body={'ceshi': '1111'} ) 这样写会直接报错,please help me ,thinks