Spaces:
Sleeping
Sleeping
Rishi commited on
Commit ·
d198d7e
1
Parent(s): a4c570d
fix(linkedin): prevent NoneType crash when rapidapi returns null data
Browse files40 unmodified lines414243444546474840 unmodified linesraw_response = response.json()# The API encapsulates the actual profile data under a 'data' key or returns it directly# Let's handle both possibilities securelydata = raw_response.get("data", raw_response) if isinstance(raw_response, dict) else raw_responseprofile_summary = {"full_name": data.get("firstName", "") + " " + data.get("lastName", ""),40 unmodified lines41424344454647484950515253545556575840 unmodified linesraw_response = response.json()# The API encapsulates the actual profile data under a 'data' key or returns it directly# Let's handle both possibilities securely, ensuring it defaults to an empty dict if Nonedata = Noneif isinstance(raw_response, dict):data = raw_response.get("data")# If data is still None (either not found or explicitly returned as null), fallback to raw_response or {}if data is None:data = raw_response if isinstance(raw_response, dict) else {}# Final safety check in case data is still somehow not a dictionaryif not isinstance(data, dict):data = {}profile_summary = {"full_name": data.get("firstName", "") + " " + data.get("lastName", ""),
tools/linkedin_tool.py+12-2