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
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. Createservices/geekflare.py in your app:
yourapp/services/geekflare.py
Web Scraping
View
yourapp/views.py
URL
yourapp/urls.py
Search
View
yourapp/views.py
URL
yourapp/urls.py
Screenshot
View
yourapp/views.py
URL
yourapp/urls.py
Using Django REST Framework
If your project uses DRF, swap the class-based views forAPIView:
yourapp/views.py
Error handling
The SDK raisesApiException with a status code and reason string on non-2xx responses.
Common error codes
| Code | Meaning |
|---|---|
401 | Missing or invalid x-api-key |
402 | API credits exhausted |
403 | Endpoint requires a higher plan |
404 | Wrong endpoint URL or HTTP method |
429 | Rate limit exceeded |
Next steps
- PHP quickstart — Native cURL and Guzzle
- API Reference — Full endpoint documentation
- SDK on PyPI