<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: annu</title>
    <description>The latest articles on DEV Community by annu (@grobeinnaffaffa).</description>
    <link>https://dev.to/grobeinnaffaffa</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4111572%2Fe7f1d0ec-6587-41ad-be45-63348d747e77.png</url>
      <title>DEV Community: annu</title>
      <link>https://dev.to/grobeinnaffaffa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/grobeinnaffaffa"/>
    <language>en</language>
    <item>
      <title># I Built a Small Tool Using Python and an Instagram API **Tags: #python #api</title>
      <dc:creator>annu</dc:creator>
      <pubDate>Sat, 05 Sep 2026 19:43:35 +0000</pubDate>
      <link>https://dev.to/grobeinnaffaffa/-i-built-a-small-tool-using-python-and-an-instagram-apitags-python-api-cl1</link>
      <guid>https://dev.to/grobeinnaffaffa/-i-built-a-small-tool-using-python-and-an-instagram-apitags-python-api-cl1</guid>
      <description>&lt;h1&gt;
  
  
  showdev**
&lt;/h1&gt;

&lt;p&gt;I recently built , and this project was a good opportunity for me to learn more about working with REST APIs and processing JSON data in Python.&lt;/p&gt;

&lt;p&gt;My stack for this project was .&lt;/p&gt;

&lt;p&gt;The basic idea was straightforward: fetch Instagram data through an API and then use that data as part of my tool's workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Built It
&lt;/h2&gt;

&lt;p&gt;I wanted to build .&lt;/p&gt;

&lt;p&gt;Instead of trying to build the entire data-fetching infrastructure myself, I experimented with &lt;a href="https://hikerapi.com" rel="noopener noreferrer"&gt;HikerAPI&lt;/a&gt;, a REST Instagram API. According to its pricing information, requests start from $0.001 per request, and it offers 100 free requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fetching the Data
&lt;/h2&gt;

&lt;p&gt;Here is the basic Python code I used to fetch a user's information and then retrieve their highlights:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;headers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;x-access-key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.hikerapi.com/v2/user/by/username?username=instagram&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;
&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.hikerapi.com/v2/user/highlights?user_id=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;pk&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The workflow is fairly simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Import the &lt;code&gt;requests&lt;/code&gt; library.&lt;/li&gt;
&lt;li&gt;Create the request headers containing the API key.&lt;/li&gt;
&lt;li&gt;Fetch information about a username.&lt;/li&gt;
&lt;li&gt;Extract the user's &lt;code&gt;pk&lt;/code&gt; value from the response.&lt;/li&gt;
&lt;li&gt;Use that ID to request the user's highlights.&lt;/li&gt;
&lt;li&gt;Print the JSON response so the tool can process it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  One Thing That Was Harder Than Expected
&lt;/h2&gt;

&lt;p&gt;One thing that was harder than I expected was .&lt;/p&gt;

&lt;p&gt;Making the API request itself was relatively straightforward, but understanding the structure of the returned JSON and figuring out exactly which fields my tool needed took more time.&lt;/p&gt;

&lt;p&gt;It was also a useful reminder that API calls can fail, responses may not always have the structure I expect, and production code needs proper error handling.&lt;/p&gt;

&lt;p&gt;For example, one improvement I would make is checking the HTTP response before immediately processing the JSON:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;API_ENDPOINT&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Request failed: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;The current version of  is still small, but I would like to improve it by adding:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;li&gt;Better error handling&lt;/li&gt;
&lt;li&gt;Configuration through environment variables&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Building this was a useful small project because it connected several things I have been learning: Python, HTTP requests, REST APIs, JSON, and .&lt;/p&gt;

&lt;p&gt;If you've built a small API-powered CLI, Discord bot, or Telegram bot, I'd love to hear what features or improvements you would add to this project.&lt;/p&gt;

</description>
      <category>python</category>
      <category>api</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
