<?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>Forem: Vishwaraja Pathi (Vishwa)</title>
    <description>The latest articles on Forem by Vishwaraja Pathi (Vishwa) (@vishwaraja_pathivishwa).</description>
    <link>https://forem.com/vishwaraja_pathivishwa</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3528251%2F5ee332b4-671b-4363-b0cd-2ac0678e1224.jpg</url>
      <title>Forem: Vishwaraja Pathi (Vishwa)</title>
      <link>https://forem.com/vishwaraja_pathivishwa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/vishwaraja_pathivishwa"/>
    <language>en</language>
    <item>
      <title>Building a Secure Gmail CLI: From Development to Production 🚀</title>
      <dc:creator>Vishwaraja Pathi (Vishwa)</dc:creator>
      <pubDate>Fri, 26 Sep 2025 10:46:05 +0000</pubDate>
      <link>https://forem.com/vishwaraja_pathivishwa/building-a-secure-gmail-cli-from-development-to-production-1g17</link>
      <guid>https://forem.com/vishwaraja_pathivishwa/building-a-secure-gmail-cli-from-development-to-production-1g17</guid>
      <description>&lt;p&gt;&lt;em&gt;How I built a comprehensive Gmail command-line interface with security-first design, Docker containerization, and CI/CD automation.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 The Problem
&lt;/h2&gt;

&lt;p&gt;As developers, we live in our terminals. We manage code, deploy applications, and debug issues all from the command line. But when it comes to email management, we're forced to switch to web browsers or desktop applications, breaking our workflow.&lt;/p&gt;

&lt;p&gt;What if we could manage Gmail directly from the terminal? What if we could read emails, send messages, manage drafts, and configure settings without leaving our development environment?&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 The Solution: Gmail CLI
&lt;/h2&gt;

&lt;p&gt;I built &lt;strong&gt;Gmail CLI&lt;/strong&gt; - a comprehensive command-line interface for Gmail that brings the full power of Gmail's API to your terminal. It's not just another email client; it's a developer-focused tool designed to integrate seamlessly into your workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✨ Key Features
&lt;/h2&gt;

&lt;h3&gt;
  
  
  📧 &lt;strong&gt;Core Email Operations&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;List emails&lt;/strong&gt; with rich formatting and filtering&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read emails&lt;/strong&gt; with full HTML/text support&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Send emails&lt;/strong&gt; with attachments and rich formatting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search emails&lt;/strong&gt; with Gmail's powerful search syntax&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mark as read/unread&lt;/strong&gt; for efficient email management&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delete emails&lt;/strong&gt; and threads&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  �� &lt;strong&gt;Advanced Features&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Draft Management&lt;/strong&gt; - Create, read, update, and send drafts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Thread Management&lt;/strong&gt; - View and manage conversation threads&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Label Management&lt;/strong&gt; - Create custom labels and organize emails&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Settings Management&lt;/strong&gt; - Configure filters, forwarding, and vacation responders&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attachment Support&lt;/strong&gt; - Download and manage email attachments&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔐 &lt;strong&gt;Security-First Design&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OAuth2 Authentication&lt;/strong&gt; - No password storage, secure token-based auth&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secure Credential Storage&lt;/strong&gt; - Credentials stored in user home directory&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Environment Variable Configuration&lt;/strong&gt; - Flexible credential path management&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensive .gitignore&lt;/strong&gt; - Prevents accidental credential commits&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ��️ Technical Implementation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Architecture
&lt;/h3&gt;

&lt;p&gt;The CLI is built with Python and leverages several key technologies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Google Gmail API&lt;/strong&gt; - Full access to Gmail's capabilities&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OAuth2 Authentication&lt;/strong&gt; - Secure, token-based authentication&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Click Framework&lt;/strong&gt; - Beautiful command-line interface&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rich Library&lt;/strong&gt; - Rich text formatting and progress bars&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker&lt;/strong&gt; - Containerized deployment for consistency&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Key Components
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Core Gmail client with comprehensive API coverage
&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GmailClient&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;credentials_path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;service&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_build_service&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;credentials_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Email operations
&lt;/span&gt;    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;list_messages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_results&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;send_message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Draft management
&lt;/span&gt;    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;create_draft&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;list_drafts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_results&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# And much more...
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔒 Security: The Most Important Feature
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Problem with Credentials
&lt;/h3&gt;

&lt;p&gt;One of the biggest challenges in building CLI tools is handling credentials securely. Too many projects accidentally commit sensitive files to version control, exposing API keys and tokens.&lt;/p&gt;

&lt;h3&gt;
  
  
  Our Security Solution
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. &lt;strong&gt;Secure Credential Storage&lt;/strong&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Credentials stored in secure user directory&lt;/span&gt;
~/.gmail-cli/credentials.json  &lt;span class="c"&gt;# Google API credentials&lt;/span&gt;
~/.gmail-cli/token.json        &lt;span class="c"&gt;# OAuth2 tokens&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. &lt;strong&gt;Environment Variable Configuration&lt;/strong&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GmailAuthenticator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;credentials_file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;token_file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="c1"&gt;# Use environment variables or secure defaults
&lt;/span&gt;        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;credentials_file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;credentials_file&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;GMAIL_CREDENTIALS_PATH&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
            &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;expanduser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;~/.gmail-cli/credentials.json&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;token_file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;token_file&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;GMAIL_TOKEN_PATH&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
            &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;expanduser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;~/.gmail-cli/token.json&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3. &lt;strong&gt;Comprehensive .gitignore&lt;/strong&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Google API credentials and tokens
token.json
credentials.json
*.json
!package.json
!tsconfig.json
!*.config.json

# Additional security patterns
*.pem
*.key
*.p12
*.pfx
secrets/
.secrets/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  4. &lt;strong&gt;Automated Security Setup&lt;/strong&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Secure setup script that:&lt;/span&gt;
&lt;span class="c"&gt;# - Creates secure directories&lt;/span&gt;
&lt;span class="c"&gt;# - Moves credentials from project directory&lt;/span&gt;
&lt;span class="c"&gt;# - Sets proper file permissions&lt;/span&gt;
&lt;span class="c"&gt;# - Configures environment variables&lt;/span&gt;
./secure-setup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🐳 Docker: Simplified and Secure
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why We Removed Docker Compose
&lt;/h3&gt;

&lt;p&gt;Initially, I used Docker Compose for the project, but I realized it was overkill for a single image. Docker Compose is great for multi-service applications, but for a single CLI tool, it adds unnecessary complexity.&lt;/p&gt;

&lt;h3&gt;
  
  
  Simplified Docker Setup
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Before (Docker Compose):
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;3.8'&lt;/span&gt;
&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;gmail-cli&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;.&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;./credentials.json:/app/credentials.json:ro&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;./token.json:/app/token.json&lt;/span&gt;
    &lt;span class="c1"&gt;# ... complex configuration&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  After (Simple Docker):
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Simple, secure Docker commands&lt;/span&gt;
docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;/data:/app/data &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-v&lt;/span&gt; ~/.gmail-cli/credentials.json:/app/credentials.json:ro &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-v&lt;/span&gt; ~/.gmail-cli/token.json:/app/token.json &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;GMAIL_CREDENTIALS_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/app/credentials.json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;GMAIL_TOKEN_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/app/token.json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  vishwa86/gmail-cli:latest list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Docker Runner Script
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;# Simplified script that handles:&lt;/span&gt;
&lt;span class="c"&gt;# - Credential security checks&lt;/span&gt;
&lt;span class="c"&gt;# - Automatic credential migration&lt;/span&gt;
&lt;span class="c"&gt;# - Proper volume mounting&lt;/span&gt;
&lt;span class="c"&gt;# - Environment variable setup&lt;/span&gt;

./docker-run.sh list          &lt;span class="c"&gt;# List emails&lt;/span&gt;
./docker-run.sh send &lt;span class="nt"&gt;--to&lt;/span&gt; user@example.com &lt;span class="nt"&gt;--subject&lt;/span&gt; &lt;span class="s2"&gt;"Hello"&lt;/span&gt; &lt;span class="nt"&gt;--body&lt;/span&gt; &lt;span class="s2"&gt;"Test"&lt;/span&gt;
./docker-run.sh shell         &lt;span class="c"&gt;# Interactive shell&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  �� CI/CD Pipeline
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Automated Workflows
&lt;/h3&gt;

&lt;p&gt;The project includes a comprehensive CI/CD pipeline using GitHub Actions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CI Pipeline&lt;/strong&gt; - Runs tests on Python 3.8-3.11, linting, and security scans&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Build&lt;/strong&gt; - Multi-architecture builds on every push&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automated Deployment&lt;/strong&gt; - Pushes to Docker Hub on main branch merges&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Version Management&lt;/strong&gt; - Automatic tagging for releases&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Workflow Features
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Multi-architecture builds&lt;/span&gt;
&lt;span class="na"&gt;platforms&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;linux/amd64,linux/arm64&lt;/span&gt;

&lt;span class="c1"&gt;# Automated testing&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Test CLI help command&lt;/span&gt;
  &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gmail --help&lt;/span&gt;

&lt;span class="c1"&gt;# Security scanning&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run Trivy vulnerability scanner&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;aquasecurity/trivy-action@master&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  📊 Usage Examples
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Daily Email Management
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Check your inbox&lt;/span&gt;
gmail list

&lt;span class="c"&gt;# Read a specific email&lt;/span&gt;
gmail &lt;span class="nb"&gt;read&lt;/span&gt; &amp;lt;message-id&amp;gt;

&lt;span class="c"&gt;# Search for emails from a specific sender&lt;/span&gt;
gmail search &lt;span class="s2"&gt;"from:boss@company.com"&lt;/span&gt;

&lt;span class="c"&gt;# Mark important emails as read&lt;/span&gt;
gmail mark &lt;span class="nb"&gt;read&lt;/span&gt; &amp;lt;message-id&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Draft Management
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create a draft for later&lt;/span&gt;
gmail drafts create &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--to&lt;/span&gt; &lt;span class="s2"&gt;"client@example.com"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--subject&lt;/span&gt; &lt;span class="s2"&gt;"Proposal Review"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--body&lt;/span&gt; &lt;span class="s2"&gt;"Please find attached..."&lt;/span&gt;

&lt;span class="c"&gt;# List all drafts&lt;/span&gt;
gmail drafts list

&lt;span class="c"&gt;# Send a draft when ready&lt;/span&gt;
gmail drafts send &amp;lt;draft-id&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Advanced Operations
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Download attachments&lt;/span&gt;
gmail download &amp;lt;message-id&amp;gt; &amp;lt;attachment-id&amp;gt;

&lt;span class="c"&gt;# Create custom labels&lt;/span&gt;
gmail label create &lt;span class="s2"&gt;"Important Projects"&lt;/span&gt; &lt;span class="nt"&gt;--color&lt;/span&gt; &lt;span class="s2"&gt;"red"&lt;/span&gt;

&lt;span class="c"&gt;# Set up vacation responder&lt;/span&gt;
gmail settings vacation &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--enable&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--subject&lt;/span&gt; &lt;span class="s2"&gt;"Out of Office"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--message&lt;/span&gt; &lt;span class="s2"&gt;"I'm currently away..."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🎨 User Experience
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Rich Terminal Output
&lt;/h3&gt;

&lt;p&gt;The CLI uses the Rich library to provide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Colorized output&lt;/strong&gt; for better readability&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Progress bars&lt;/strong&gt; for long operations&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tables&lt;/strong&gt; for structured data display&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Syntax highlighting&lt;/strong&gt; for email content&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Comprehensive Help System
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Get detailed help with examples&lt;/span&gt;
gmail help-detailed

&lt;span class="c"&gt;# Command-specific help&lt;/span&gt;
gmail send &lt;span class="nt"&gt;--help&lt;/span&gt;
gmail drafts &lt;span class="nt"&gt;--help&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔮 Lessons Learned
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Security First&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Always design with security in mind from the start&lt;/li&gt;
&lt;li&gt;Use environment variables for configuration&lt;/li&gt;
&lt;li&gt;Implement comprehensive .gitignore rules&lt;/li&gt;
&lt;li&gt;Create automated security setup scripts&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Simplicity Over Complexity&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Docker Compose isn't always necessary&lt;/li&gt;
&lt;li&gt;Simple Docker commands can be more maintainable&lt;/li&gt;
&lt;li&gt;Focus on the core functionality first&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Developer Experience&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Rich terminal output improves usability&lt;/li&gt;
&lt;li&gt;Comprehensive help systems reduce learning curve&lt;/li&gt;
&lt;li&gt;Consistent command structure across all operations&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Automation is Key&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;CI/CD pipelines catch issues early&lt;/li&gt;
&lt;li&gt;Automated security scanning prevents vulnerabilities&lt;/li&gt;
&lt;li&gt;Multi-architecture builds ensure compatibility&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  �� Getting Started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Google Cloud Project&lt;/strong&gt; with Gmail API enabled&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OAuth2 Credentials&lt;/strong&gt; downloaded from Google Cloud Console&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker&lt;/strong&gt; (optional but recommended)&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Using Docker (Recommended)&lt;/span&gt;
git clone https://github.com/vishwaraja/gmail-cli.git
&lt;span class="nb"&gt;cd &lt;/span&gt;gmail-cli
./docker-setup.sh
./secure-setup.sh
./docker-run.sh auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  First Run
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Authenticate with Gmail&lt;/span&gt;
gmail auth

&lt;span class="c"&gt;# Start using the CLI&lt;/span&gt;
gmail list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  �� Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository&lt;/strong&gt;: &lt;a href="https://github.com/vishwaraja/gmail-cli" rel="noopener noreferrer"&gt;github.com/vishwaraja/gmail-cli&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Hub&lt;/strong&gt;: &lt;a href="https://hub.docker.com/r/vishwa86/gmail-cli" rel="noopener noreferrer"&gt;hub.docker.com/r/vishwa86/gmail-cli&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation&lt;/strong&gt;: Comprehensive README with examples&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Guide&lt;/strong&gt;: Detailed security best practices&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🤝 Contributing
&lt;/h2&gt;

&lt;p&gt;The project is open source and welcomes contributions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bug Reports&lt;/strong&gt;: Help improve stability&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feature Requests&lt;/strong&gt;: Suggest new functionality&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code Contributions&lt;/strong&gt;: Submit pull requests&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation&lt;/strong&gt;: Improve guides and examples&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  💭 Conclusion
&lt;/h2&gt;

&lt;p&gt;Gmail CLI represents more than just a command-line email client. It's a testament to the power of developer-focused tools that integrate seamlessly into existing workflows. By bringing Gmail to the terminal, we're not just changing how we manage emails—we're reimagining the developer experience.&lt;/p&gt;

&lt;p&gt;The journey from initial development to production-ready tool taught me valuable lessons about security, simplicity, and automation. The most important takeaway: &lt;strong&gt;security should be designed in from the start, not bolted on later&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Whether you're a terminal enthusiast, a DevOps engineer, or simply someone who values efficiency, Gmail CLI offers a new way to interact with one of the most important communication tools in our digital lives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ready to transform your email workflow?&lt;/strong&gt; Give Gmail CLI a try and experience the power of terminal-based email management.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;What's your experience with command-line email tools? Have you tried Gmail CLI? Share your thoughts and experiences in the comments below!&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Tags
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;gmail&lt;/code&gt; &lt;code&gt;cli&lt;/code&gt; &lt;code&gt;python&lt;/code&gt; &lt;code&gt;docker&lt;/code&gt; &lt;code&gt;automation&lt;/code&gt; &lt;code&gt;productivity&lt;/code&gt; &lt;code&gt;terminal&lt;/code&gt; &lt;code&gt;email&lt;/code&gt; &lt;code&gt;oauth2&lt;/code&gt; &lt;code&gt;github-actions&lt;/code&gt; &lt;code&gt;devops&lt;/code&gt; &lt;code&gt;open-source&lt;/code&gt; &lt;code&gt;security&lt;/code&gt; &lt;code&gt;docker-compose&lt;/code&gt; &lt;code&gt;simplification&lt;/code&gt;&lt;/p&gt;

</description>
      <category>cli</category>
      <category>python</category>
      <category>docker</category>
    </item>
    <item>
      <title>Building a Comprehensive Reddit CLI Tool: From Basic Posting to Full Reddit Management with 33+ Commands</title>
      <dc:creator>Vishwaraja Pathi (Vishwa)</dc:creator>
      <pubDate>Fri, 26 Sep 2025 08:52:43 +0000</pubDate>
      <link>https://forem.com/vishwaraja_pathivishwa/building-a-comprehensive-reddit-cli-tool-from-basic-posting-to-full-reddit-management-with-33-533f</link>
      <guid>https://forem.com/vishwaraja_pathivishwa/building-a-comprehensive-reddit-cli-tool-from-basic-posting-to-full-reddit-management-with-33-533f</guid>
      <description>&lt;h1&gt;
  
  
  Building a Comprehensive Reddit CLI Tool: From Basic Posting to Full Reddit Management
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;🚀 &lt;strong&gt;A complete journey from a simple Reddit posting tool to a professional-grade CLI with 33+ commands, Docker support, and comprehensive Reddit API integration.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;As a developer and Reddit enthusiast, I found myself needing to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Post content across multiple subreddits efficiently&lt;/li&gt;
&lt;li&gt;Monitor discussions and engage with communities&lt;/li&gt;
&lt;li&gt;Research topics and find relevant subreddits&lt;/li&gt;
&lt;li&gt;Manage my Reddit presence programmatically&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Existing tools were either too complex, limited in functionality, or required extensive setup. I needed something that was both powerful and easy to use.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: Reddit CLI Tool
&lt;/h2&gt;

&lt;p&gt;I built a comprehensive command-line interface that provides &lt;strong&gt;33+ commands&lt;/strong&gt; covering every aspect of Reddit interaction. Here's what makes it special:&lt;/p&gt;

&lt;h3&gt;
  
  
  �� &lt;strong&gt;Key Features&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;📝 Complete Content Management&lt;/strong&gt;: Post, edit, delete, and manage Reddit content&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;💬 Advanced Commenting&lt;/strong&gt;: Comment, reply, and engage with communities&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🔍 Powerful Search&lt;/strong&gt;: Search posts, comments, and subreddits across Reddit&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;👥 User Management&lt;/strong&gt;: View profiles, follow users, and manage relationships&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;�� Content Discovery&lt;/strong&gt;: Find trending subreddits and hot posts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;💾 Content Organization&lt;/strong&gt;: Save, unsave, and organize your Reddit content&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;�� Messaging System&lt;/strong&gt;: Send and receive private messages&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🗳️ Voting System&lt;/strong&gt;: Upvote and downvote posts and comments&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🏷️ Flair Support&lt;/strong&gt;: Use subreddit flairs for better categorization&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🐳 Docker Ready&lt;/strong&gt;: Easy deployment with Docker containers&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🚀 &lt;strong&gt;Quick Start&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clone and setup&lt;/span&gt;
git clone https://github.com/vishwaraja/reddit-cli.git
&lt;span class="nb"&gt;cd &lt;/span&gt;reddit-cli
./setup.sh

&lt;span class="c"&gt;# Start using immediately&lt;/span&gt;
./run.sh post askreddit &lt;span class="s2"&gt;"What's your favorite programming language?"&lt;/span&gt; &lt;span class="nt"&gt;--content&lt;/span&gt; &lt;span class="s2"&gt;"I'm curious about what developers prefer and why."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Technical Implementation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Architecture&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The tool is built with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Python 3.11+&lt;/strong&gt; with PRAW (Python Reddit API Wrapper)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker&lt;/strong&gt; for easy deployment and consistency&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensive error handling&lt;/strong&gt; with exponential backoff&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rate limiting&lt;/strong&gt; to comply with Reddit's API limits&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Beautiful terminal output&lt;/strong&gt; with emojis and clear formatting&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Command Categories&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  📝 &lt;strong&gt;Content Management (6 commands)&lt;/strong&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./run.sh post askreddit &lt;span class="s2"&gt;"Title"&lt;/span&gt; &lt;span class="nt"&gt;--content&lt;/span&gt; &lt;span class="s2"&gt;"Content"&lt;/span&gt;
./run.sh comment &lt;span class="s2"&gt;"post_url"&lt;/span&gt; &lt;span class="s2"&gt;"comment_text"&lt;/span&gt;
./run.sh edit-post &lt;span class="s2"&gt;"post_url"&lt;/span&gt; &lt;span class="s2"&gt;"new_content"&lt;/span&gt;
./run.sh delete &lt;span class="s2"&gt;"post_url"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  🔍 &lt;strong&gt;Discovery &amp;amp; Search (6 commands)&lt;/strong&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./run.sh search-subreddits &lt;span class="s2"&gt;"machine learning"&lt;/span&gt; &lt;span class="nt"&gt;--limit&lt;/span&gt; 10
./run.sh search-posts &lt;span class="s2"&gt;"Python tutorial"&lt;/span&gt; &lt;span class="nt"&gt;--subreddit&lt;/span&gt; &lt;span class="s2"&gt;"learnpython"&lt;/span&gt;
./run.sh hot programming &lt;span class="nt"&gt;--limit&lt;/span&gt; 10
./run.sh trending &lt;span class="nt"&gt;--limit&lt;/span&gt; 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  👥 &lt;strong&gt;User Management (4 commands)&lt;/strong&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./run.sh user-profile &lt;span class="s2"&gt;"spez"&lt;/span&gt;
./run.sh user-posts &lt;span class="s2"&gt;"username"&lt;/span&gt; &lt;span class="nt"&gt;--limit&lt;/span&gt; 10
./run.sh follow &lt;span class="s2"&gt;"username"&lt;/span&gt;
./run.sh friends
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  🗳️ &lt;strong&gt;Voting &amp;amp; Engagement (2 commands)&lt;/strong&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./run.sh upvote &lt;span class="s2"&gt;"post_url"&lt;/span&gt;
./run.sh downvote &lt;span class="s2"&gt;"post_url"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  📬 &lt;strong&gt;Messaging (2 commands)&lt;/strong&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./run.sh message &lt;span class="s2"&gt;"username"&lt;/span&gt; &lt;span class="s2"&gt;"Subject"&lt;/span&gt; &lt;span class="s2"&gt;"Message body"&lt;/span&gt;
./run.sh inbox &lt;span class="nt"&gt;--limit&lt;/span&gt; 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  🏷️ &lt;strong&gt;Subreddit Management (6 commands)&lt;/strong&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./run.sh flairs askreddit
./run.sh subreddit-info &lt;span class="s2"&gt;"MachineLearning"&lt;/span&gt;
./run.sh subscribe &lt;span class="s2"&gt;"MachineLearning"&lt;/span&gt;
./run.sh moderators &lt;span class="s2"&gt;"MachineLearning"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  �� &lt;strong&gt;Monitoring (2 commands)&lt;/strong&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./run.sh responses &lt;span class="s2"&gt;"post_url"&lt;/span&gt; &lt;span class="nt"&gt;--limit&lt;/span&gt; 20
./run.sh monitor &lt;span class="s2"&gt;"post_url"&lt;/span&gt; &lt;span class="nt"&gt;--interval&lt;/span&gt; 60
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Beautiful Help System&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The tool features a comprehensive help system with emoji-rich commands and detailed examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./run.sh &lt;span class="nt"&gt;--help&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Shows all 33+ commands with clear descriptions and usage examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Use Cases
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Content Creators&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Automated Posting&lt;/strong&gt;: Schedule and manage content across multiple subreddits&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community Engagement&lt;/strong&gt;: Monitor responses and engage with your audience&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Content Research&lt;/strong&gt;: Find trending topics and popular discussions&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Developers&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Project Promotion&lt;/strong&gt;: Share your open-source projects with relevant communities&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Technical Discussions&lt;/strong&gt;: Participate in programming and tech subreddits&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Learning Resources&lt;/strong&gt;: Find and share educational content&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Researchers&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Collection&lt;/strong&gt;: Gather insights from Reddit discussions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trend Analysis&lt;/strong&gt;: Monitor trending topics and community sentiment&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Academic Research&lt;/strong&gt;: Study online communities and social behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Business Users&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Brand Management&lt;/strong&gt;: Monitor mentions and engage with customers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Market Research&lt;/strong&gt;: Understand customer needs and preferences&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community Building&lt;/strong&gt;: Build and nurture online communities&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Technical Challenges &amp;amp; Solutions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Rate Limiting&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Reddit has strict API rate limits. I implemented:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Exponential backoff&lt;/strong&gt; for failed requests&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automatic retry logic&lt;/strong&gt; with configurable delays&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User-friendly error messages&lt;/strong&gt; explaining rate limits&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Error Handling&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Comprehensive error handling for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authentication issues&lt;/strong&gt; (401 errors)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permission problems&lt;/strong&gt; (403 errors)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network timeouts&lt;/strong&gt; and connection issues&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Invalid input validation&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Docker Integration&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Made the tool Docker-ready for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Easy setup&lt;/strong&gt; without Python environment conflicts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consistent deployment&lt;/strong&gt; across different systems&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Isolated execution&lt;/strong&gt; environment&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Code Quality &amp;amp; Best Practices
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Professional Features&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Type hints&lt;/strong&gt; throughout the codebase&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensive docstrings&lt;/strong&gt; for all functions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modular architecture&lt;/strong&gt; with clear separation of concerns&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consistent error handling&lt;/strong&gt; patterns&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User-friendly output&lt;/strong&gt; with emojis and clear formatting&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Open Source Ready&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;MIT License&lt;/strong&gt; for maximum compatibility&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensive README&lt;/strong&gt; with examples and documentation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker support&lt;/strong&gt; for easy deployment&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub repository&lt;/strong&gt; with proper structure&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Results &amp;amp; Impact
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What We Achieved&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;33+ commands&lt;/strong&gt; covering all major Reddit APIs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Professional-grade&lt;/strong&gt; error handling and rate limiting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker containerization&lt;/strong&gt; for easy deployment&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensive documentation&lt;/strong&gt; and help system&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open source&lt;/strong&gt; with MIT license&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;User Experience&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Beautiful terminal output&lt;/strong&gt; with emojis and clear formatting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Intuitive command structure&lt;/strong&gt; that's easy to remember&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensive help system&lt;/strong&gt; with examples&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fast execution&lt;/strong&gt; with proper rate limiting&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Future Enhancements
&lt;/h2&gt;

&lt;p&gt;While the tool is already feature-complete, potential future enhancements include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cross-posting&lt;/strong&gt; functionality&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advanced moderation&lt;/strong&gt; tools&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analytics and insights&lt;/strong&gt; features&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scheduling&lt;/strong&gt; capabilities&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web interface&lt;/strong&gt; for non-technical users&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Prerequisites&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Docker (recommended) or Python 3.11+&lt;/li&gt;
&lt;li&gt;Reddit API credentials&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Quick Setup&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clone the repository&lt;/span&gt;
git clone https://github.com/vishwaraja/reddit-cli.git
&lt;span class="nb"&gt;cd &lt;/span&gt;reddit-cli

&lt;span class="c"&gt;# Run setup script&lt;/span&gt;
./setup.sh

&lt;span class="c"&gt;# Configure your Reddit API credentials&lt;/span&gt;
&lt;span class="nb"&gt;cp &lt;/span&gt;reddit_config.json.example reddit_config.json
&lt;span class="c"&gt;# Edit reddit_config.json with your credentials&lt;/span&gt;

&lt;span class="c"&gt;# Start using!&lt;/span&gt;
./run.sh &lt;span class="nt"&gt;--help&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Reddit API Setup&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="https://www.reddit.com/prefs/apps" rel="noopener noreferrer"&gt;Reddit App Preferences&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Click "Create App" or "Create Another App"&lt;/li&gt;
&lt;li&gt;Fill in the form:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name&lt;/strong&gt;: Any name (e.g., "My Reddit CLI")&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;App type&lt;/strong&gt;: Select "script"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Redirect URI&lt;/strong&gt;: &lt;code&gt;http://localhost:8080&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Note down your &lt;strong&gt;Client ID&lt;/strong&gt; and &lt;strong&gt;Client Secret&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Building this Reddit CLI tool was an incredible journey that taught me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;API Integration&lt;/strong&gt;: How to work with complex APIs like Reddit's&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error Handling&lt;/strong&gt;: The importance of robust error handling and user feedback&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User Experience&lt;/strong&gt;: How small details like emojis and clear formatting make a big difference&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker&lt;/strong&gt;: The power of containerization for easy deployment&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open Source&lt;/strong&gt;: The value of building tools that others can use and contribute to&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The tool is now &lt;strong&gt;production-ready&lt;/strong&gt; with 33+ commands, comprehensive error handling, and professional-grade features. It's open source, well-documented, and ready for the community to use and contribute to.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Key Takeaways&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Start simple, iterate fast&lt;/strong&gt;: We began with basic posting and gradually added features&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User experience matters&lt;/strong&gt;: Beautiful output and clear help make tools more usable&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error handling is crucial&lt;/strong&gt;: Robust error handling prevents user frustration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation is key&lt;/strong&gt;: Good documentation makes tools accessible to everyone&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open source benefits everyone&lt;/strong&gt;: Sharing tools helps the entire community&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository&lt;/strong&gt;: &lt;a href="https://github.com/vishwaraja/reddit-cli" rel="noopener noreferrer"&gt;https://github.com/vishwaraja/reddit-cli&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reddit API Documentation&lt;/strong&gt;: &lt;a href="https://praw.readthedocs.io/" rel="noopener noreferrer"&gt;https://praw.readthedocs.io/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Documentation&lt;/strong&gt;: &lt;a href="https://docs.docker.com/" rel="noopener noreferrer"&gt;https://docs.docker.com/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;What do you think? Have you built similar CLI tools? What challenges did you face? Let me know in the comments!&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  python #reddit #cli #automation #praw #docker #opensource #api #commandline
&lt;/h1&gt;

</description>
      <category>reddit</category>
      <category>python</category>
      <category>cli</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Building a PDF Parser for HDFC Bank Statements: From 165 Pages to CSV in Minutes</title>
      <dc:creator>Vishwaraja Pathi (Vishwa)</dc:creator>
      <pubDate>Thu, 25 Sep 2025 05:06:36 +0000</pubDate>
      <link>https://forem.com/vishwaraja_pathivishwa/building-a-pdf-parser-for-hdfc-bank-statements-from-165-pages-to-csv-in-minutes-34c6</link>
      <guid>https://forem.com/vishwaraja_pathivishwa/building-a-pdf-parser-for-hdfc-bank-statements-from-165-pages-to-csv-in-minutes-34c6</guid>
      <description>&lt;h2&gt;
  
  
  Building a PDF Parser for HDFC Bank Statements: From 165 Pages to CSV in Minutes
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;🚀 &lt;a href="https://github.com/vishwaraja/hdfc-pdf-converter" rel="noopener noreferrer"&gt;GitHub Repository&lt;/a&gt; | ⭐ Star it if you find it useful!&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The Problem That Started It All
&lt;/h2&gt;

&lt;p&gt;Picture this: You're an auditor, accountant, or financial analyst staring at a &lt;strong&gt;165-page HDFC Bank statement&lt;/strong&gt; with &lt;strong&gt;3,602 transactions&lt;/strong&gt; that need to be converted to CSV format. The manual process would take days, and the risk of errors is enormous.&lt;/p&gt;

&lt;p&gt;That's exactly the challenge I faced recently, and it led me to build an open-source solution that I'm excited to share with the community.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: HDFC PDF to CSV Converter
&lt;/h2&gt;

&lt;p&gt;I created a Python tool that automatically extracts all transactions from HDFC Bank PDF statements and converts them to CSV format with intelligent categorization. Here's what it accomplishes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ &lt;strong&gt;100% extraction rate&lt;/strong&gt; from 165-page PDFs&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;3,602 transactions&lt;/strong&gt; processed automatically&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;22 automatic categories&lt;/strong&gt; (UPI, Foreign Exchange, Salary, etc.)&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;Multi-line narration support&lt;/strong&gt; for complex transactions&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;Multiple output formats&lt;/strong&gt; (CSV, Excel, Markdown)&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;Command-line interface&lt;/strong&gt; for easy automation&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quick Start
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clone the repository&lt;/span&gt;
git clone https://github.com/vishwaraja/hdfc-pdf-converter.git
&lt;span class="nb"&gt;cd &lt;/span&gt;hdfc-pdf-converter

&lt;span class="c"&gt;# Install dependencies&lt;/span&gt;
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt

&lt;span class="c"&gt;# Convert your first PDF (creates ./results/ directory automatically)&lt;/span&gt;
python src/hdfc_converter.py your_statement.pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Technical Deep Dive
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Tech Stack
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Core dependencies
&lt;/span&gt;&lt;span class="n"&gt;camelot&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;  &lt;span class="c1"&gt;# PDF table extraction
&lt;/span&gt;&lt;span class="n"&gt;pandas&lt;/span&gt;          &lt;span class="c1"&gt;# Data manipulation
&lt;/span&gt;&lt;span class="n"&gt;PyPDF2&lt;/span&gt;          &lt;span class="c1"&gt;# PDF processing
&lt;/span&gt;&lt;span class="n"&gt;pdfplumber&lt;/span&gt;      &lt;span class="c1"&gt;# Text extraction
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Challenge: Multi-line Narrations
&lt;/h3&gt;

&lt;p&gt;One of the biggest challenges was handling transactions where the narration spans multiple lines. Here's how I solved it:&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="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_parse_transaction_row&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;page_num&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Parse a single transaction row with multi-line support.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="c1"&gt;# Handle multi-line narrations
&lt;/span&gt;    &lt;span class="n"&gt;narration_parts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

    &lt;span class="c1"&gt;# Everything between date and amounts is narration
&lt;/span&gt;    &lt;span class="n"&gt;narration_start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="n"&gt;narration_end&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;narration_start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;narration_end&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;part&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;iloc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;&lt;span class="nf"&gt;strip&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;part&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;part&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;nan&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;narration_parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;narration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;narration_parts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;narration&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Intelligent Categorization
&lt;/h3&gt;

&lt;p&gt;The tool automatically categorizes transactions into 22 meaningful categories:&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="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;categorize_transaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;narration&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;narration_lower&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;narration&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;word&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;narration_lower&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;word&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;salary&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;payroll&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;betterplace&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Salary &amp;amp; Employment&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="nf"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;word&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;narration_lower&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;word&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;foreign&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;usd&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;eur&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;gbp&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Foreign Exchange&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="nf"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;word&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;narration_lower&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;word&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;upi&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;UPI Payments&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
    &lt;span class="c1"&gt;# ... and 19 more categories
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Real Results
&lt;/h2&gt;

&lt;p&gt;Here's what the tool achieved with my 165-page statement:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total Transactions&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;3,602&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Pages Processed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;165/165 (100%)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Extraction Time&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~2 minutes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Categories Identified&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Data Quality&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;100% valid dates&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Sample Output
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Date,Narration,Category,Withdrawal_Amount,Deposit_Amount
15/07/2020,UPI payment to merchant,UPI Payments,150.00,0.00
16/07/2020,Salary credit from company,Salary &amp;amp; Employment,0.00,25000.00
17/07/2020,Foreign remittance from USA,Foreign Exchange,0.00,50000.00
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Usage Examples
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Command Line Interface
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Basic usage (creates ./results/ directory automatically)&lt;/span&gt;
python src/hdfc_converter.py statement.pdf

&lt;span class="c"&gt;# Custom output directory&lt;/span&gt;
python src/hdfc_converter.py statement.pdf &lt;span class="nt"&gt;--output-dir&lt;/span&gt; ./my_results

&lt;span class="c"&gt;# Verbose logging for debugging&lt;/span&gt;
python src/hdfc_converter.py statement.pdf &lt;span class="nt"&gt;--verbose&lt;/span&gt;

&lt;span class="c"&gt;# Convert PDF from different directory&lt;/span&gt;
python src/hdfc_converter.py /path/to/statements/hdfc_2024.pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Programmatic API
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;src.hdfc_converter&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;HDFCConverter&lt;/span&gt;

&lt;span class="c1"&gt;# Initialize converter
&lt;/span&gt;&lt;span class="n"&gt;converter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;HDFCConverter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;statement.pdf&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;output_dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;./results&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Convert PDF to CSV
&lt;/span&gt;&lt;span class="n"&gt;success&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;converter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;convert&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;success&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;✅ Conversion completed successfully!&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;
  
  
  The Impact
&lt;/h2&gt;

&lt;p&gt;This tool has already saved me &lt;strong&gt;hours of manual work&lt;/strong&gt; and eliminated the risk of transcription errors. But more importantly, it's now available as an open-source solution for the entire community.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Benefits for Users:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Auditors&lt;/strong&gt;: Quick conversion of bank statements for analysis&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accountants&lt;/strong&gt;: Automated data entry from PDF statements&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fintech Developers&lt;/strong&gt;: Foundation for building banking tools&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Analysts&lt;/strong&gt;: Clean CSV data for financial analysis&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Open Source and Community
&lt;/h2&gt;

&lt;p&gt;I've made this tool completely open source with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📚 &lt;strong&gt;Comprehensive documentation&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;🧪 &lt;strong&gt;Unit tests and examples&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;🤝 &lt;strong&gt;Contribution guidelines&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;📋 &lt;strong&gt;Issue templates and PR templates&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;🔄 &lt;strong&gt;CI/CD pipeline&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🔗 Repository: &lt;a href="https://github.com/vishwaraja/hdfc-pdf-converter" rel="noopener noreferrer"&gt;https://github.com/vishwaraja/hdfc-pdf-converter&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;I'm excited to see how the community will use and improve this tool. Some potential enhancements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Support for other bank PDF formats&lt;/li&gt;
&lt;li&gt;GUI interface for non-technical users&lt;/li&gt;
&lt;li&gt;Cloud processing capabilities&lt;/li&gt;
&lt;li&gt;Advanced filtering and search features&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;p&gt;Building this tool taught me several valuable lessons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;PDF parsing is complex&lt;/strong&gt; - Different banks use different formats&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-line data is tricky&lt;/strong&gt; - Requires careful parsing logic&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Categorization needs intelligence&lt;/strong&gt; - Simple regex isn't enough&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation is crucial&lt;/strong&gt; - Makes tools accessible to others&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open source is powerful&lt;/strong&gt; - Community feedback improves everything&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Get Started
&lt;/h2&gt;

&lt;p&gt;Ready to try it out? Here's how to get started:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clone the repository&lt;/span&gt;
git clone https://github.com/vishwaraja/hdfc-pdf-converter.git
&lt;span class="nb"&gt;cd &lt;/span&gt;hdfc-pdf-converter

&lt;span class="c"&gt;# Install dependencies&lt;/span&gt;
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt

&lt;span class="c"&gt;# Convert your first PDF&lt;/span&gt;
python src/hdfc_converter.py your_statement.pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;What started as a personal problem-solving exercise became a tool that could benefit the entire developer and financial community. This is the power of open source - turning individual solutions into community resources.&lt;/p&gt;

&lt;p&gt;I'd love to hear your thoughts, suggestions, and use cases. Have you faced similar challenges with PDF processing? What other banking tools would be useful to the community?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connect with me:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/vishwaraja" rel="noopener noreferrer"&gt;@vishwaraja&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Email: &lt;a href="mailto:vishwaraja.pathi@adiyogitech.com"&gt;vishwaraja.pathi@adiyogitech.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Repository: &lt;a href="https://github.com/vishwaraja/hdfc-pdf-converter" rel="noopener noreferrer"&gt;hdfc-pdf-converter&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Have questions about PDF parsing or want to contribute to the project? Leave a comment below - I'd love to discuss!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>opensource</category>
      <category>pdf</category>
      <category>hdfc</category>
    </item>
  </channel>
</rss>
