DEV Community

Taj Avcb
Taj Avcb

Posted on

My Experience with HikerAPI

Get an Instagram Profile in 10 Lines of Python

I recently experimented with HikerAPI while working with a Python project and wanted to see how simple it would be to retrieve Instagram profile data through a REST API.

Instead of building a scraper from scratch, I decided to test a direct API request using Python's requests library.

What I'm Building

The goal is simple: send an Instagram username to the API and print the JSON response.

You only need Python and the requests package for this example.

Install Requests

First, install requests if it isn't already available:

pip install requests
Enter fullscreen mode Exit fullscreen mode

Then create a Python file and add:

import requests

headers = {"x-access-key": "YOUR_KEY"}

resp = requests.get(
    "https://api.hikerapi.com/v2/user/by/username?username=apple",
    headers=headers
)

print(resp.json())
Enter fullscreen mode Exit fullscreen mode

Replace YOUR_KEY with your own HikerAPI access key.

How It Works

The headers dictionary contains the access key used for the API request.

requests.get() sends a GET request to the HikerAPI endpoint, with apple as the username.

Finally, resp.json() converts the JSON response into Python data that I can inspect or process further.

For a small experiment, this is much simpler than maintaining a custom scraper because the API gives me a structured HTTP interface instead of requiring me to handle scraping logic myself.

What I Learned

My main takeaway was that getting started with an API can be surprisingly simple. I didn't need a large Python framework or complicated setup for this basic test—just an API key and a few lines of Python.

From here, I could add error handling, process specific fields from the response, or integrate the request into a larger project.

If you're learning Python and APIs, this is a nice small project to experiment with because you can see the complete flow: authentication, HTTP request, and JSON response.

You can learn more about HikerAPI at https://hikerapi.com/.

python #api #webscraping

Top comments (0)