I have a scenario where I have a dictionary containing an ID a list corresponding to that ID in the following format:
{
"abc123":["https://www.url.com/", "https://www.url2.com"],
"def456": ["https://www.url3.com/"],
.
.
.
"xyz890": ["https://www.anotherurl.com/", "https://anotherurl2.com/", "https://www.anotherurl3.com/"]
}
I have an external API that requires all URLs to be passed as a single list so, I want to concatenate all the URLs against each key in a single list and pass that list to the API (I could send each list separately but I want to avoid multiple API calls as network costs are a deciding factor). The API as a response, sends back the URLs in another list that it finds malicious. Now I want to find out what the ID value for these URLs is in my dictionary.
The problem is that I will have to lookup those malicious URLs against each list in the dictionary and find out their original IDs which I believe is a very crude and slow approach. Can someone please suggest me any simple technique to achieve this?
Let me know if someone needs additional context. Thanks for taking out the time to read this.