简体   繁体   中英

python reverse phone lookup with twilio

I've been looking for a way to do reverse phone lookups with python. I know there are other ways but it would be great if I could do it in python. The module I'm using is twilio which I'm not sure is the best method. If there's a better way can someone tell me? Anyways, what I have so far only tells me a phone number's carrier, I'm trying to get more specific information like names, emails, addresses, ip addresses, locations, and any personal info. If someone could help me with this little project that would be great:)

What I have so far:

import sys
import os
from twilio.rest.lookups import TwilioLookupsClient

try:
    client = TwilioLookupsClient()
    phone = raw_input (" Enter The Targets Phone Number: ")

    number = client.phone_numbers.get((phone), include_carrier_info=True, )
    print(number.carrier['name'])
    print(number.carrier['type'])
except:
    print ("Error handling phone number")

Twilio developer evangelist here.

If you're looking for even more data on top of what Twilio itself provides then you probably should take a look at our Add-on marketplace .

We have add-ons for the Lookups API , including the following which should help with your specific situation:

Whitepages Pro Caller Identification

Whitepages Pro Caller Identification helps you identify an unknown caller's name, their demographics, including age range and gender, and address. It also provides phone details, including line-type, carrier, and pre-paid status.

Advanced Caller ID by Next Caller

Next Caller can identify +600M phone numbers with the following data points: Name, Address, Email, Carrier, Line Type, Secondary Phone, Age, Gender, Household Income, Marital Status, Presence of Children, Home Owner Status, Home Market Value, Length of Residence, High Net Worth, Occupation, Education Level, Twitter Handle & Followers, Facebook Profile & Followers, LinkedIn Profile

Both of these APIs can be added as part of the Lookups API so you can gather all the information you're after.

Let me know if that helps at all.

Edit:

Here's an example of calling the API using the Whitepages Pro Add-on from above. This is using the Twilio Python library, version 6.4.3.

import os
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)

number = client.lookups.phone_numbers("+15108675309").fetch(type="carrier", add_ons="whitepages_pro_caller_id")

print(number.add_ons)

number.add_ons is a dict of the results from any add on you include. It's probably best to just inspect it to see what data you want to extract.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM