Django app for Google Ads API authentication and basic functionality
Project description
Django Google Ads Authentication
A Django app that provides Google Ads API authentication and basic functionality for managing campaigns.
Features
- OAuth2 authentication with Google Ads API
- Store and manage refresh tokens
- Track campaign statuses
- Basic campaign management functionality
Installation
Install the package using pip:
pip install django-googleadsauth
local installation
- clone the repo
- add a volume in your docker compose setup pointing to the package directory
volumes:
- ./app/src:/app/src
- ./app/logs:/app/logs
- ./app/logs/gunicorn:/var/log/gunicorn
- ./app/local-cdn:/app/local-cdn
- /home/tarik/django-googleadsauth:/app/django-googleadsauth
- in your
pyproject.tomladd a dependency
dependencies = [
"django>=5.1.5",
...
"django-googleadsauth @ file:///app/django-googleadsauth"
]
- make sure to freeze the dependencies in the
requirements.txt file
uv pip compile pyproject.toml -o requirements.txt
Configuration
- Add
googleadsauthto yourINSTALLED_APPSinsettings.py:
INSTALLED_APPS = [
...
'googleadsauth',
...
]
- configure your
.envfile
GOOGLE_ADS_CLIENT_SECRET_PATH=/app/google-secret.json
GOOGLE_ADS_REDIRECT_URI=http://localhost:8082/google/oauth/redirect
GOOGLE_ADS_DEVELOPER_TOKEN=xxxxxxxx
GOOGLE_ADS_CLIENT_ID=xxxxx
GOOGLE_ADS_CLIENT_SECRET=xxxx
GOOGLE_ADS_TOKEN_URI=https://oauth2.googleapis.com/token
GOOGLE_ADS_MANAGER_ACCOUNT_ID=xxxx
- Add the required Google Ads API settings to your
settings.py:
GOOGLE_ADS = {
'CLIENT_SECRET_PATH': os.getenv('GOOGLE_ADS_CLIENT_SECRET_PATH'),
'REDIRECT_URI': os.getenv('GOOGLE_ADS_REDIRECT_URI'),
'DEVELOPER_TOKEN': os.getenv('GOOGLE_ADS_DEVELOPER_TOKEN'),
'CLIENT_ID': os.getenv('GOOGLE_ADS_CLIENT_ID'),
'CLIENT_SECRET': os.getenv('GOOGLE_ADS_CLIENT_SECRET'),
'MANAGER_ACCOUNT_ID': os.getenv('GOOGLE_ADS_MANAGER_ACCOUNT_ID'), # Optional
}
- Include the app URLs in your project's
urls.py:
from django.urls import path, include
urlpatterns = [
...
path('googleads/', include('googleadsauth.urls')),
...
]
- Run migrations:
python manage.py migrate googleadsauth
Usage
Authentication
- Navigate to
/googleads/auth/to start the OAuth2 authentication flow - After successful authentication, the app will store the refresh token
Development
To set up for development:
- Clone the repository
- Install development dependencies
- Run the test suite
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_googleadsauth-0.1.0.tar.gz.
File metadata
- Download URL: django_googleadsauth-0.1.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78f93e3148d0b3149a86c89e592139c5ab95150b5790c73c9841154eab1332b9
|
|
| MD5 |
d6664b49a2001170031e0ddd70aeb190
|
|
| BLAKE2b-256 |
fc6ad5787e8520fa423c1b0bfac594243685cb42e74b2ea7e56a431dea7ec49d
|
File details
Details for the file django_googleadsauth-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_googleadsauth-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d74697ae8bf3aaa4795cb001a2af75e340838d7ecc5be93795d7c4ad634cc1ae
|
|
| MD5 |
b8f2fe3177ebe0b60e87918f37d4477d
|
|
| BLAKE2b-256 |
3b5e48eaa3a65ae9496be68956ce5b307133f012a732a57616c8196ee5b7b1c1
|