# 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:
```bash
pip install django-googleadsauth
```
## local installation
1. clone the repo
2. add a volume in your docker compose setup pointing to the package directory
```shell
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
```
3. in your `pyproject.toml` add a dependency
```shell
dependencies = [
"django>=5.1.5",
...
"django-googleadsauth @ file:///app/django-googleadsauth"
]
```
4. make sure to freeze the dependencies in the `requirements.txt file`
```shell
uv pip compile pyproject.toml -o requirements.txt
```
## Configuration
1. Add `googleadsauth` to your `INSTALLED_APPS` in `settings.py`:
```python
INSTALLED_APPS = [
...
'googleadsauth',
...
]
```
2. configure your `.env` file
```dotenv
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
```
2. Add the required Google Ads API settings to your `settings.py`:
```python
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
}
```
3. Include the app URLs in your project's `urls.py`:
```python
from django.urls import path, include
urlpatterns = [
...
path('googleads/', include('googleadsauth.urls')),
...
]
```
4. Run migrations:
```bash
python manage.py migrate googleadsauth
```
## Usage
### Authentication
1. Navigate to `/googleads/auth/` to start the OAuth2 authentication flow
2. After successful authentication, the app will store the refresh token
## Development
To set up for development:
1. Clone the repository
2. Install development dependencies
3. Run the test suite
## License
MIT License
Raw data
{
"_id": null,
"home_page": "https://github.com/tarikwaleed/django-googleadsauth",
"name": "django-googleadsauth",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "django, google ads, google api, authentication, oauth2, campaign management",
"author": "Tarek Walid",
"author_email": "tarek@otomatika.tech",
"download_url": "https://files.pythonhosted.org/packages/fc/6a/d5787e8520fa423c1b0bfac594243685cb42e74b2ea7e56a431dea7ec49d/django_googleadsauth-0.1.0.tar.gz",
"platform": null,
"description": "# Django Google Ads Authentication\n\nA Django app that provides Google Ads API authentication and basic functionality for managing campaigns.\n\n## Features\n\n- OAuth2 authentication with Google Ads API\n- Store and manage refresh tokens\n- Track campaign statuses\n- Basic campaign management functionality\n\n## Installation\n\nInstall the package using pip:\n\n```bash\npip install django-googleadsauth\n```\n## local installation\n1. clone the repo\n2. add a volume in your docker compose setup pointing to the package directory\n```shell\n volumes:\n - ./app/src:/app/src\n - ./app/logs:/app/logs\n - ./app/logs/gunicorn:/var/log/gunicorn\n - ./app/local-cdn:/app/local-cdn\n - /home/tarik/django-googleadsauth:/app/django-googleadsauth\n```\n3. in your `pyproject.toml` add a dependency\n```shell\n\ndependencies = [\n \"django>=5.1.5\",\n ...\n \"django-googleadsauth @ file:///app/django-googleadsauth\"\n]\n```\n4. make sure to freeze the dependencies in the `requirements.txt file`\n```shell\nuv pip compile pyproject.toml -o requirements.txt \n```\n\n## Configuration\n\n1. Add `googleadsauth` to your `INSTALLED_APPS` in `settings.py`:\n\n```python\nINSTALLED_APPS = [\n ...\n 'googleadsauth',\n ...\n]\n```\n2. configure your `.env` file\n```dotenv\nGOOGLE_ADS_CLIENT_SECRET_PATH=/app/google-secret.json\nGOOGLE_ADS_REDIRECT_URI=http://localhost:8082/google/oauth/redirect\nGOOGLE_ADS_DEVELOPER_TOKEN=xxxxxxxx\nGOOGLE_ADS_CLIENT_ID=xxxxx\nGOOGLE_ADS_CLIENT_SECRET=xxxx\nGOOGLE_ADS_TOKEN_URI=https://oauth2.googleapis.com/token\nGOOGLE_ADS_MANAGER_ACCOUNT_ID=xxxx\n```\n\n2. Add the required Google Ads API settings to your `settings.py`:\n\n```python\nGOOGLE_ADS = {\n 'CLIENT_SECRET_PATH': os.getenv('GOOGLE_ADS_CLIENT_SECRET_PATH'),\n 'REDIRECT_URI': os.getenv('GOOGLE_ADS_REDIRECT_URI'),\n 'DEVELOPER_TOKEN': os.getenv('GOOGLE_ADS_DEVELOPER_TOKEN'),\n 'CLIENT_ID': os.getenv('GOOGLE_ADS_CLIENT_ID'),\n 'CLIENT_SECRET': os.getenv('GOOGLE_ADS_CLIENT_SECRET'),\n 'MANAGER_ACCOUNT_ID': os.getenv('GOOGLE_ADS_MANAGER_ACCOUNT_ID'), # Optional\n}\n```\n\n3. Include the app URLs in your project's `urls.py`:\n\n```python\nfrom django.urls import path, include\n\nurlpatterns = [\n ...\n path('googleads/', include('googleadsauth.urls')),\n ...\n]\n```\n\n4. Run migrations:\n\n```bash\npython manage.py migrate googleadsauth\n```\n\n## Usage\n\n### Authentication\n\n1. Navigate to `/googleads/auth/` to start the OAuth2 authentication flow\n2. After successful authentication, the app will store the refresh token\n\n\n## Development\n\nTo set up for development:\n\n1. Clone the repository\n2. Install development dependencies\n3. Run the test suite\n\n## License\n\nMIT License\n",
"bugtrack_url": null,
"license": null,
"summary": "Django app for Google Ads API authentication and basic functionality",
"version": "0.1.0",
"project_urls": {
"Bug Tracker": "https://github.com/tarikwaleed/django-googleadsauth/issues",
"Documentation": "https://github.com/tarikwaleed/django-googleadsauth#readme",
"Homepage": "https://github.com/tarikwaleed/django-googleadsauth",
"Source Code": "https://github.com/tarikwaleed/django-googleadsauth"
},
"split_keywords": [
"django",
" google ads",
" google api",
" authentication",
" oauth2",
" campaign management"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "3b5e48eaa3a65ae9496be68956ce5b307133f012a732a57616c8196ee5b7b1c1",
"md5": "b8f2fe3177ebe0b60e87918f37d4477d",
"sha256": "d74697ae8bf3aaa4795cb001a2af75e340838d7ecc5be93795d7c4ad634cc1ae"
},
"downloads": -1,
"filename": "django_googleadsauth-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b8f2fe3177ebe0b60e87918f37d4477d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 10976,
"upload_time": "2025-04-20T22:04:43",
"upload_time_iso_8601": "2025-04-20T22:04:43.862742Z",
"url": "https://files.pythonhosted.org/packages/3b/5e/48eaa3a65ae9496be68956ce5b307133f012a732a57616c8196ee5b7b1c1/django_googleadsauth-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "fc6ad5787e8520fa423c1b0bfac594243685cb42e74b2ea7e56a431dea7ec49d",
"md5": "d6664b49a2001170031e0ddd70aeb190",
"sha256": "78f93e3148d0b3149a86c89e592139c5ab95150b5790c73c9841154eab1332b9"
},
"downloads": -1,
"filename": "django_googleadsauth-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "d6664b49a2001170031e0ddd70aeb190",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 10594,
"upload_time": "2025-04-20T22:04:45",
"upload_time_iso_8601": "2025-04-20T22:04:45.931463Z",
"url": "https://files.pythonhosted.org/packages/fc/6a/d5787e8520fa423c1b0bfac594243685cb42e74b2ea7e56a431dea7ec49d/django_googleadsauth-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-04-20 22:04:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tarikwaleed",
"github_project": "django-googleadsauth",
"github_not_found": true,
"lcname": "django-googleadsauth"
}