1

请找到以下代码

data={
    "OptPersonFacility": "Facility",
    "ProfessionID":"3",
    "LicenseTypeId": "258",
    "State": "",
    "Country": "ALL",
    "County": "null",
    "IsFacility": "1",
    "PersonId": "null",
    "PageNo": "1",
    }
response=session.post("https://www.pals.pa.gov/api/Search/SearchForPersonOrFacilty",data=data)

我得到的回应是

{
"Message": "An error has occurred."
}

实际需要的响应:

[{"IsFacility":0,"FirstName":"","MiddleName":"","LastName":"","FacilityName":"A F MCGERVEY & CO LLC","ProfessionID":null,"LicenseTypeId":null,"LicenseNumber":"AF000392L","LicenceType":"Accountancy Firm","ProfessionType":"Accountancy","Status":"Active","AddressLine1":null,"AddressLine2":null,"City":"PITTSBURGH","State":"Pennsylvania","County":"Allegheny","Country":"United States","zipcode":"15236","OptPersonFacility":null,"FullName":null,"PersonId":14551,"FacilityStreetAddress":"5329 BROWNSVILLE ROAD   PITTSBURGH PA 15236","DisciplinaryActionTypeId":null,"DisciplinaryAction":null,"ComplaintNumber":null,"ComplaintFromDate":"0001-01-01T00:00:00","ComplaintToDate":"0001-01-01T00:00:00","AddressLine3":"","AddressLine4":"PITTSBURGH, PA 15236","CountryShortCode":"UNITED_STATES","BoardName":"State Board of Accountancy","RequestedFileName":null,"RequestedFileId":null,"LicenseId":961054,"RecaptchaResponse":"","Row":1,"PageNo":0,"TotalRecords":4400,"NameSuffix":"","PhoneNo1":"","Emailid1":"","McareDocketNumber":"","McareCourtFiled":"","McareServed":"","FictitiousName":"","DoingBusinessAs":"","IsPersonFacility":false,"ComplaintCloseDate":null}]

我错过了什么吗?

4

1 回答 1

1

我没有 Session 并作为实际 json 发送并用空字符串文字替换 Null

import requests

data = {"OptPersonFacility":"Facility","ProfessionID":3,"LicenseTypeId":258,"State":"","Country":"ALL","County":"","IsFacility":1,"PersonId":"","PageNo":1}
r = requests.post('https://www.pals.pa.gov/api/Search/SearchForPersonOrFacilty', json=data).json()
print(r)
于 2019-12-27T08:40:05.497 回答