I generated one fake name with the code below using requests, and it returns something like this:
import requests
url = "https://api.namefake.com/portuguese-brazil/"
response = requests.request("GET", url)
response.text
'{"name":"Dr. Juliana Serrano Jr.","address":"34324-447, Avenida Abgail Uchoa, 9700. Apto 897\\nBenjamin do Leste - SE","latitude":77.06972999999999,"longitude":6.098246999999986,"maiden_name":"Cruz","birth_data":"1994-01-12","phone_h":"(83) 3708-5018","phone_w":"(47) 8538-5076","email_u":"hernani.tamoio","email_d":"kongshuon.com","username":"fabiana07","password":"lDq&@JQpd_{9onR@@\'","domain":"zaragoca.org","useragent":"Mozilla\\/5.0 (compatible; MSIE 7.0; Windows NT 5.0; Trident\\/5.0)","ipv4":"206.30.52.9","macaddress":"44:E2:9E:ED:4E:7E","plasticcard":"4849466573413","cardexpir":"02\\/25","bonus":17,"company":"Caldeira de Toledo","color":"green","uuid":"d79ee164-ea4c-3d30-ab4d-0212a965befc","height":191,"weight":82.4,"blood":"O\\u2212","eye":"Amber","hair":"Straight, Auburn","pict":"4female","url":"https:\\/\\/api.namefake.com\\/portuguese-brazil\\/female\\/a117774757fb71d0a409555812b66251","sport":"Water Polo","ipv4_url":"\\/\\/myip-address.com\\/ip-lookup\\/206.30.52.9","email_url":"\\/\\/emailfake.com\\/kongshuon.com\\/hernani.tamoio","domain_url":"\\/\\/myip-address.com\\/ip-lookup\\/zaragoca.org"}'
I would like to normalize using df = pandas.json_normalize(response.text)
, but I get an error.
If I export this response to a json file, and add the [ at the beginning, and the ] and the end, it works.
So I tried to create a return_api = f"[{response.text}]"
and tried to normalize again and didn't work.
Am I missing something?
Thanks!