Skip to content

bulk_search function converting list to string in the wrong way #34

@cvipul

Description

@cvipul
async def bulk_search(phoneNumbers, countryCode, installationId):
    """
    Perform bulk search for a list of phone numbers using Truecaller API.

    Args:
        phoneNumbers (list[str]): The list of phone numbers to search.
        countryCode (str): The country code of the phone numbers.
        installationId (str): The installation ID for authorization.

The function expects "phoneNumbers" as a list of numbers
but within the contents of the function, converts it into a string and send to the API

params = {
        "q": str(phoneNumbers),
        "countryCode": countryCode,
        "type": 14,
        "placement": "SEARCHRESULTS,HISTORY,DETAILS",
        "encoding": "json"
    }

While this works in getting a response from truecaller, the response have the wrong content in the "key" section

{'status_code': 200, 
 'data': {
	'data': [
		{'key': "['1234567890'",
                 ....
                }
        ]
  }
}

We should either convert the list of numbers into a comma separated string again or just ask for a comma separated string of numbers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions