MCPcopy
hub / github.com/wechaty/python-wechaty / fetch_github_user_avatar_url

Function fetch_github_user_avatar_url

src/wechaty/utils/link.py:22–40  ·  view source on GitHub ↗

fetch_github_user_avatar_url refer to: https://docs.github.com/en/rest/users/users#get-a-user Args: name (str): the name of github user Returns: str: the avatar url of github user

(name: str)

Source from the content-addressed store, hash-verified

20
21
22def fetch_github_user_avatar_url(name: str) -> str:
23 """fetch_github_user_avatar_url
24
25 refer to: https://docs.github.com/en/rest/users/users#get-a-user
26
27 Args:
28 name (str): the name of github user
29
30 Returns:
31 str: the avatar url of github user
32 """
33 source_avatar_url = f'https://api.github.com/users/{name}'
34
35 header = {
36 "accept": "application/vnd.github.v3+jso"
37 }
38 response = requests.get(source_avatar_url, headers=header)
39 data = response.json()
40 return data.get('avatar_url', None)

Callers 1

Calls 1

getMethod · 0.80

Tested by 1