import json
from datetime import datetime
import requests
print('Получение актуальных cookie\n')
url = 'http://тут ссылка'
response = requests.get(url)
print('Скачали\n')
data = json.loads(response)
#print(data)
Traceback (most recent call last):
File "C:\Users\User\Desktop\test\test3.py", line 21, in
data = json.loads(response)
File "C:\Program Files\Python310\lib\json\__init__.py", line 339, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Response
import requests
url = "http://detailing69.ru/wb_cookies.json"
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'
}
res = requests.get(url, headers=headers)
if res.status_code == 200:
print(res.json())
else:
print(f"ОшибкО: {res.status_code}")
# [{'seller': 'Оксана ', 'cookies': {'general': '1', 'statistics': '2', 'supplies': '3', 'advertisement': '4'}}]
data = json.loads(response.text)
# Import JSON module
import json
# Define JSON string
jsonString = '{ "id": 121, "name": "Naveen", "course": "MERN Stack"}'
# Convert JSON String to Python
student_details = json.loads(jsonString)
# Print Dictionary
print(student_details)
# Print values using keys
print(student_details['name'])
print(student_details['course'])