Skip to content

Commit

Permalink
fix: worker api url
Browse files Browse the repository at this point in the history
  • Loading branch information
okradze committed Jan 6, 2024
1 parent 313eed7 commit b9c96b3
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions apps/worker/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,27 +111,26 @@ def check_single_fine_tuning_task(fine_tuning_id: str):
)
def register_campaign_phone_call_tasks():
res = requests.get(
f"{Config.PR_DEV_SERVER_URL}/campaign/due",
f"{Config.PR_DEV_SERVER_URL}/v1/campaign/due",
headers={"Authorization": f"Bearer {Config.SERVER_AUTH_TOKEN}"},
)

campaigns = res.json()
print(campaigns)
return campaigns
# campaign_ids = [campaign["id"] for campaign in campaigns]

# for campaign in campaigns:
# res = requests.post(
# f"{Config.PR_DEV_SERVER_URL}/campaign/{campaign['id']}/start",
# headers={"Authorization": f"Bearer {Config.SERVER_AUTH_TOKEN}"},
# )
campaign_ids = [campaign["id"] for campaign in campaigns]

# contact_ids = res.json()
for campaign in campaigns:
res = requests.post(
f"{Config.PR_DEV_SERVER_URL}/v1/campaign/{campaign['id']}/start",
headers={"Authorization": f"Bearer {Config.SERVER_AUTH_TOKEN}"},
)

contact_ids = res.json()

# for contact_id in contact_ids:
# make_phone_call.apply_async(args=[campaign["id"], contact_id])
for contact_id in contact_ids:
make_phone_call.apply_async(args=[campaign["id"], contact_id])

# return campaign_ids
return campaign_ids


@app.task(
Expand All @@ -142,7 +141,7 @@ def register_campaign_phone_call_tasks():
)
def make_phone_call(campaign_id: str, contact_id: str):
res = requests.post(
f"{Config.PR_DEV_SERVER_URL}/call/campaign",
f"{Config.PR_DEV_SERVER_URL}/v1/call/campaign",
headers={"Authorization": f"Bearer {Config.SERVER_AUTH_TOKEN}"},
data={
"campaign_id": campaign_id,
Expand All @@ -155,7 +154,7 @@ def make_phone_call(campaign_id: str, contact_id: str):
# Checks for the status of the phone call to make sure phone call is finished
while True:
status_res = requests.get(
f"{Config.PR_DEV_SERVER_URL}/call/{call_id}",
f"{Config.PR_DEV_SERVER_URL}/v1/call/{call_id}",
headers={"Authorization": f"Bearer {Config.SERVER_AUTH_TOKEN}"},
)

Expand Down

0 comments on commit b9c96b3

Please sign in to comment.