简体   繁体   English

Http 响应 Python

[英]Http Response Python

like the response.json() does not display anything but on the other hand the response.text displays the results how to loop through response.text Exemple de mon code像 response.json() 不显示任何内容,但另一方面 response.text 显示结果如何循环通过 response.text 示例演示代码

def api:
  url = 'http://api-content/product/GetProduct'
  x = requests.get(url)
  content=x.text

"produits":[{
    "des":"blaa",
     "cont":"sdf"
 }]

Merci de votre aide感谢投票的助手

I always do json.loads(x.text) and that seems to work for me我总是做json.loads(x.text)这似乎对我有用

def api:
  url = 'http://api-content/product/GetProduct'
  x = requests.get(url)
  import json
  r = json.loads(x.text)
  for i in r:
      print(i)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM