Skip to content

Commit

Permalink
Add user_avatar request.
Browse files Browse the repository at this point in the history
  • Loading branch information
emmiegit committed Jan 15, 2024
1 parent 5db34fe commit 377fbe0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions yellowstone/requests/user_avatar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Download a user's avatar.
"""

import logging
from datetime import datetime

import requests

logger = logging.getLogger(__name__)


def get(user_id: int) -> bytes:
# We include the timestamp to blend in with regular requests
r = requests.get(
"https://www.wikidot.com/avatar.php",
params={
"userid": user_id,
"timestamp": int(datetime.now().timestamp()),
},
)
r.raise_for_status()
return r.content

0 comments on commit 377fbe0

Please sign in to comment.