Ask coding questions

← Back to all posts
How to get user image
ch1ck3n (1622)

I'm making a project in django, and i'm using replit auth. when authed i want to display the user picture to the client but I can't figure out how to. is there a HTTP header for the user picture or do I just have to scrape it off the replit page (I really don't want to do some scraping)

Answered by 19ecal (230) [earned 5 cycles]
View Answer
19ecal (230)

You can request to<user> and parse the JSON returned, then get data["icon"]["url"]

19ecal (230)
import requests, json
19ecal (230)

That returns the url for their profile picture, or None if they have a default one

ch1ck3n (1622)

@19ecal :O thank you so much! which post should i mark as correct

ryanbrwr (33)

There currently doesn't seem to be a header to get the user picture. I read in one of the comment sections that os.getenv("REPL_IMAGE") gives the URL. Here's the link to the thread: . Hope this helps!

ch1ck3n (1622)

@ryanbrwr But doesn't
that get the repl owner's pfp?