I am learning to get json data from a link and use that data later on. But i am getting error: "RuntimeError: maximum recursion depth exceeded while calling a Python object"
Here is my code:
import json
import requests
from bs4 import BeautifulSoup
url = "http://example.com/category/page=2&YII_CSRF_TOKEN=31eb0a5d28f4dde909d3233b5a0c23bd03348f69&more_products=true"
header = {'x-requested-with': 'XMLHttpRequest'}
mainPage = requests.get(url, headers = header)
xTree = BeautifulSoup(mainPage.content, "lxml")
newDictionary=json.loads(str(xTree))
print (newDictionary)
EDIT: Okay I got the response data from using this slight change, here is the new code:
import json
import requests
from bs4 import BeautifulSoup
url = "http://example.com/category/page=2&YII_CSRF_TOKEN=31eb0a5d28f4dde909d3233b5a0c23bd03348f69&more_products=true"
header = {'x-requested-with': 'XMLHttpRequest'}
mainPage = requests.get(url, headers = header
print (mainPage.json())