Metadata-Version: 2.4
Name: django-googleadsauth
Version: 0.1.0
Summary: Django app for Google Ads API authentication and basic functionality
Home-page: https://github.com/tarikwaleed/django-googleadsauth
Author: Tarek Walid
Author-email: tarek@otomatika.tech
Project-URL: Bug Tracker, https://github.com/tarikwaleed/django-googleadsauth/issues
Project-URL: Documentation, https://github.com/tarikwaleed/django-googleadsauth#readme
Project-URL: Source Code, https://github.com/tarikwaleed/django-googleadsauth
Keywords: django,google ads,google api,authentication,oauth2,campaign management
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.2
Classifier: Framework :: Django :: 4.0
Classifier: Framework :: Django :: 4.1
Classifier: Framework :: Django :: 4.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=3.2
Requires-Dist: google-ads>=18.0.0
Requires-Dist: google-auth-oauthlib>=0.4.6
Requires-Dist: google-api-python-client>=2.0.0
Requires-Dist: google-auth>=2.0.0
Requires-Dist: djangorestframework>=3.12.0
Requires-Dist: requests>=2.25.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 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
