Python请求模块可以在我的Windows笔记本电脑上工作,但不能在AWS上工作

Python请求模块可以在我的Windows笔记本电脑上工作,但不能在AWS上工作,python,json,amazon-web-services,ubuntu,Python,Json,Amazon Web Services,Ubuntu,我是python的新手,所以如果我错过了一些基本的东西,我很抱歉。 我有一个关于从网站获取信息的代码,脚本可以在我笔记本电脑上的vscode上运行,但当我用相同的加载量尝试相同的代码时,它在AWS ubuntu和windows虚拟计算机上不起作用。代码如下: url_arama = "https://www.sahibinden.com/otomobil/benzin,benzin-lpg/manuel/sahibinden?a4_max=250000&sorting=date

我是python的新手,所以如果我错过了一些基本的东西,我很抱歉。 我有一个关于从网站获取信息的代码,脚本可以在我笔记本电脑上的vscode上运行,但当我用相同的加载量尝试相同的代码时,它在AWS ubuntu和windows虚拟计算机上不起作用。代码如下:

url_arama = "https://www.sahibinden.com/otomobil/benzin,benzin-lpg/manuel/sahibinden?a4_max=250000&sorting=date_desc&a8=62068&viewType=Classic&a5_min=2004&price_min=25000&price_max=55000"
headers = {"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36'}

page = requests.get(url_arama, headers=headers).text
soup = BeautifulSoup(page, "html.parser")    

response = page.json()
print(response)
输出为:

Traceback (most recent call last):
  File "c:\Users\Administrator\Desktop\SahibindenBot\aaa.py", line 26, in <module>
    sahibinden()
  File "c:\Users\Administrator\Desktop\SahibindenBot\aaa.py", line 24, in sahibinden
    response = page.json()
AttributeError: 'str' object has no attribute 'json'
回溯(最近一次呼叫最后一次):
文件“c:\Users\Administrator\Desktop\SahibindenBot\aaa.py”,第26行,在
萨希宾登()
文件“c:\Users\Administrator\Desktop\SahibindenBot\aaa.py”,第24行,在sahibinden中
response=page.json()
AttributeError:'str'对象没有属性'json'
我试着联系谷歌,但这个网站不起作用,为什么

AttributeError:'str'对象没有属性'json'

试试这个:

import json

response = json.loads(page)

我怀疑代码在另一台机器上工作。我猜它与环境没有什么关系。看一下回溯,看看错误是怎么说的。