AttributeError: 'function' object has no attribute 'json'

AttributeError: 'function' object has no attribute 'json'

我正在尝试使用 PaperQuotes API 和 Pillow 编写一些自动引用图像生成代码,但是这一小段代码把一切都搞砸了。 (如果代码不好,我很抱歉,我还是一个编码新手)

代码:

import requests
import os

url = "https://api.paperquotes.com/apiv1/quotes/?lang=en&limit=1&offset=0&order=-likes&page=1&tags=love%2Clife%2Cdepression%2Csuicide%2Csad%2Clonely"

my_secret = os.environ['authorization']

headers = {
    'authorization': my_secret,
    }

response = requests.get(url, headers=headers).json

info = response.json
print(info["results"]) 

错误:

AttributeError: 'function' object has no attribute 'json' 

我尝试搜索 Whosebug,但我无法理解我得到的任何答案。

Json 它的功能,而不是 属性。 另外 info = response 因为你得到了 json.

import requests
import os

url = "https://api.paperquotes.com/apiv1/quotes/?lang=en&limit=1&offset=0&order=-likes&page=1&tags=love%2Clife%2Cdepression%2Csuicide%2Csad%2Clonely"

my_secret = os.environ['authorization']

headers = {
    'authorization': my_secret,
    }

response = requests.get(url, headers=headers).json()

info = response
print(info["results"])