Spaces:
Sleeping
Sleeping
File size: 573 Bytes
8f10d41 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import requests
def get_user_profile(user_id, access_token):
url = f'https://api.line.me/v2/bot/profile/{user_id}'
headers = {
'Authorization': f'Bearer {access_token}'
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
profile = response.json()
user_name = profile.get('displayName')
user_thumbnail = profile.get('pictureUrl')
return user_name, user_thumbnail
else:
print(f"Failed to get user profile: {response.status_code}, {response.text}")
return None, None |