-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1c54ae
commit a76389f
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from celery import shared_task | ||
from .hubspot import delete_hubspot_lead | ||
|
||
@shared_task | ||
def delete_hubspot_lead_task(lead_id): | ||
response = delete_hubspot_lead(lead_id) | ||
if response.status_code == 204: | ||
return {'status': 'success', 'message': 'Lead deleted successfully'} | ||
else: | ||
return {'status': 'error', 'message': 'Failed to delete lead', 'details': response.json()} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from __future__ import absolute_import, unicode_literals | ||
import os | ||
from celery import Celery | ||
from django.conf import settings | ||
|
||
# Set the default Django settings module for the 'celery' program. | ||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'crm_analytics.settings') | ||
|
||
app = Celery('crm_analytics') | ||
|
||
# Using a string here means the worker doesn't have to serialize | ||
# the configuration object to child processes. | ||
# - namespace='CELERY' means all celery-related configuration keys | ||
# should have a `CELERY_` prefix. | ||
app.config_from_object('django.conf:settings', namespace='CELERY') | ||
|
||
# Load task modules from all registered Django app configs. | ||
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) | ||
|
||
@app.task(bind=True) | ||
def debug_task(self): | ||
print(f'Request: {self.request!r}') |