Skip to main content
This guide uses the official geekflare-api Python SDK inside a Django project. We’ll create a reusable service class, wire it into Django views, and keep secrets out of source control with python-decouple.

Prerequisites

  • Python 3.8+
  • Django 4.0+
  • A Geekflare API key — get one free

Installation

Or with uv:

Set your API key

.env
python-decouple reads from .env automatically. Add .env to .gitignore.

Service class

Keep all Geekflare logic in one place. Create services/geekflare.py in your app:
yourapp/services/geekflare.py

Web Scraping

View

yourapp/views.py

URL

yourapp/urls.py
Test:

View

yourapp/views.py

URL

yourapp/urls.py
Test:

Screenshot

View

yourapp/views.py

URL

yourapp/urls.py
Test:

Using Django REST Framework

If your project uses DRF, swap the class-based views for APIView:
yourapp/views.py

Error handling

The SDK raises ApiException with a status code and reason string on non-2xx responses.

Common error codes

See Rate Limit Exceeded and Credit Exhausted for strategies to handle these gracefully.

Next steps