• 通过身份证查取手机号
  • 2025-06-01 11:27:53
  • import requests

    def query_mobile(api_key, id_card):

    url = 'https://www.juhe.cn/'

    params = {

    'cardno': id_card,

    'key': api_key

    }

    response = requests.get(url, params=params)

    result = response.json()

    if result['error_code'] == 0:

    mobile = result['result']['phone']

    print(f'身份证号码 {id_card} 对应的手机号码是 {mobile}')

    else:

    error_msg = result['reason']

    print(f'查询失败:{error_msg}')

    # 使用聚合数据提供的 API Key

    api_key = 'your_api_key'

    id_card_number = '632126199702080439'

    query_mobile(api_key, id_card_number)