Menu

Build a Daily Horoscope Feature in Python in 10 Minutes (with DivineAPI)
📰

Build a Daily Horoscope Feature in Python in 10 Minutes (with DivineAPI)

DEV Community·Karan Desai·7 months ago
#PqaW5ETQ
#python#sign#horoscope#divineapi#headers
Reading 0:00
15s threshold

The problem

A client wanted daily horoscopes on their wellness app. All 12 signs, refreshed daily, English first with Hindi coming in phase two. The deadline was end of week. I did not want to spend three days reading documentation for an API I had never used.

Here is the stack I ended up with, and the working Python you can drop into a project today.

What I used

DivineAPI for the horoscope endpoint

Python 3.11

The requests library (pip install requests)

About 10 minutes of actual work

Step 1: Get your API key

Sign up at divineapi.com, 14-day free trial, you will need a credit card to register. Once you are in the dashboard, grab your API key. Two things they hand you that you will need:

The api_key value (goes in the request body)

An Authorization token (goes in the header as Bearer {token})

Yes, two separate auth bits. I did not catch this on first read and spent ten minutes wondering why I was getting 401s.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.