DEV Community

Jeffrey.Feillp
Jeffrey.Feillp

Posted on

Automate Your Dev.to Publishing With This Simple Python Script

Automate Your Dev.to Publishing With This Simple Python Script

Every developer who writes on Dev.to knows the pain: you finish writing a great article, save it as markdown, then spend 5 minutes clicking through the publishing UI. Do that for a 5-article series and you've wasted 25 minutes.

I built a command-line tool that reduces this to one command.

How It Works

The script reads all markdown files from a directory, extracts metadata from YAML frontmatter, logs into Dev.to via your credentials, and publishes each article in sequence.

Before:

✗ Open browser
✗ Navigate to dev.to/new
✗ Paste content
✗ Add tags
✗ Click publish
✗ Repeat 5 times
→ ~25 minutes
Enter fullscreen mode Exit fullscreen mode

After:

$ python publish.py ./articles/
→ ~30 seconds
Enter fullscreen mode Exit fullscreen mode

The Tech

The script handles three tricky parts of Dev.to's backend:

  1. CSRF Token Chain — It extracts the authenticity token from the login page, authenticates, then gets a fresh token from the dashboard that works for article creation.

  2. Session Persistence — Saves session cookies to a JSON file so you don't need to re-login every time. Sessions last for weeks.

  3. Rate Limit Handling — Dev.to allows roughly one publish per 30 seconds. The script auto-waits between publishes and retries on failure.

Real-World Test

I've published 5 articles using this tool across different topics — all went live without issues. The script handled everything from login to final publish.

Get the Complete Package

What's included:

  • publish_devto.py — Main script with full login flow
  • publish_session.py — Session persistence version
  • publish_batch.py — Batch processing for multiple articles
  • README (English + Chinese)
  • Requirements file
  • Example article with frontmatter template

$15 USDT (TRC-20) — One-time purchase, no subscription.

TNeUMpbwWFcv6v7tYHmkFkE7gC5eWzqbrs
Enter fullscreen mode Exit fullscreen mode

Full details: https://telegra.ph/Devto-Batch-Publisher--15-USDT-One-Time-Purchase-04-29

Contact: Telegram @tianka_ai | Email: tianka@tuta.io


Built with Python 3 and requests. Tested on Linux and Termux (Android).

Top comments (0)