I am trying to get data from this site.
My code to get the data is:
import requests
import pandas as pd
from bs4 import BeautifulSoup
import json
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'
}
data = {
'columns[0][name]': 'ID_Societe',
'columns[1][name]': 'sNom',
'columns[2][name]': 'sURL',
'columns[3][name]': 'sGroupe',
'columns[4][name]': 'nFonds',
'columns[5][name]': 'nParts',
'columns[6][name]': 'nEncours',
'columns[7][name]': 'dtEncours',
'columns[8][name]': 'sAwards',
'columns[9][name]': 'nAAA',
'columns[10][name]': 'nAA',
'columns[11][name]': 'nA',
'columns[12][name]': 'dtAwards',
'order[0][column]': '2',
'order[0][dir]': 'asc',
'start': '0',
'length': '10',
}
response = requests.post('https://www.quantalys.com/SocieteGestion/ListeData', headers=headers, data=data)
df_list_sdg = pd.DataFrame(response.json()['data'])
df_list_sdg
but I had an error message which is:
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I don’t understand why I get this error message.
Any help will be helpful.
2
Answers
The response of your request is
which is html and not json
It seems that you need to send more parameters to get correct repsonse:
Prints: