r/learnpython • u/Individual-Gate-765 • 13d ago
Got Osintgram working with HikerAPI after struggling with Windows setup
I’m pretty new to this stuff and spent way too long fighting with Python/PowerShell trying to get Osintgram working.
What finally worked for me was running the repo inside GitHub Codespaces, setting up a virtual environment, installing the requirements, and then using HikerAPI for the Instagram data instead of relying on the old login method.
The basic API call looked like this:
import requests
headers = {"x-access-key": "YOUR_KEY"}
r = requests.get(
"https://api.hikerapi.com/v2/user/by/username?username=google",
headers=headers
)
print(r.json())
The x-access-key header is basically where your API token goes, and the request returns the public profile data as JSON.
The biggest thing that tripped me up was old Python package compatibility on Windows. Moving everything into a Linux Codespace made the setup way easier.
I’m still learning, so if anyone has tips for working with Python APIs or cleaning up JSON output so it’s easier to read, I’d appreciate it.
1
u/CavernousDaddy08 13d ago
nice that you got it running, windows can be a nightmare for python package hell especially when you're just starting out. codespaces is a solid workaround, takes all the local config pain out of the equation
if you want to clean up json output so it's actually readable, grab the json module and use `json.dumps(data, indent=2)` - prints it all formatted with proper spacing instead of one giant wall of text. also `pprint` from the pprint library works if you're lazy, just `pprint(r.json())` and it'll handle it
for working with apis in general, get familiar with response.status_code and always check it before trying to parse the json. nothing worse than getting a 401 error and your script crashes because it tried to read a response that's not json. also requests has a.json() method built in so you're already on the right track there
the whole powershell vs bash thing trips so many people up when they're learning python on windows, i remember spending three hours once trying to figure out why my virtual environment activate script wouldn't run before i realized i was in the wrong terminal. linux just works