Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cvipul opened this issue Jan 24, 2024 · 1 comment
Open

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

cvipul opened this issue Jan 24, 2024 · 1 comment

Comments

@cvipul
Copy link

cvipul commented Jan 24, 2024

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.

@cvipul
Copy link
Author

cvipul commented Jan 24, 2024

@sumithemmadi - I will raise a PR in case you agree that we should make this small change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant