└── code4 /code4: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | def get_github_profile(username): 4 | url = f"https://api.github.com/users/{username}" 5 | response = requests.get(url) 6 | if response.status_code == 200: 7 | return response.json() 8 | else: 9 | return None 10 | 11 | def display_profile_info(profile): 12 | if profile: 13 | print(f"Username: {profile['login']}") 14 | print(f"Name: {profile['name']}") 15 | print(f"Bio: {profile['bio']}") 16 | print(f"Public Repositories: {profile['public_repos']}") 17 | print(f"Followers: {profile['followers']}") 18 | print(f"Following: {profile['following']}") 19 | else: 20 | print("User not found.") 21 | 22 | if __name__ == "__main__": 23 | username = input("Enter your GitHub username: ") 24 | profile = get_github_profile(username) 25 | display_profile_info(profile) 26 | --------------------------------------------------------------------------------