How do I parse a JSON response from Python Requests?

后端 未结 7 1223
悲&欢浪女
悲&欢浪女 2021-02-19 00:09

I am trying to parse a response.text that I get when I make a request using the Python Requests library. For example:

def check_user(s         


        
7条回答
  •  离开以前
    2021-02-19 00:36

    Put in the return of your method like this:

    return self.response.json()

    If you wanna looking for more details, click this following link: https://www.w3schools.com/python/ref_requests_response.asp

    and search for json() method.

    Here is an code example:

    import requests
    url = 'https://www.w3schools.com/python/demopage.js'
    x = requests.get(url)
    print(x.json())
    

提交回复
热议问题