Skip to content

Commit ad71b8a

Browse files
committed
grabbing digest parameters
1 parent 1278159 commit ad71b8a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

linkedin_post_generator.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
import google.generativeai as genai
66
from datetime import datetime, timezone, timedelta
77

8+
from dateutil.parser import parse
9+
from datetime import datetime, timedelta, timezone
10+
11+
# Get today's date
12+
today = datetime.today()
13+
14+
# Calculate the date 7 days ago
15+
seven_days_ago = today - timedelta(days=7)
16+
17+
# Format the date in YYYY-MM-DD format
18+
formatted_date = seven_days_ago.strftime('%Y-%m-%d')
19+
20+
# The variable to store the date
21+
date_seven_days_ago = formatted_date
22+
823
# Load environment variables from .env file
924
load_dotenv()
1025

@@ -37,7 +52,7 @@ def get_latest_buttondown_email():
3752
# For now, we'll assume the default API call without specific filters might return
3853
# recent ones and we'll pick the absolute latest from the results.
3954
# A more robust approach might involve `?ordering=-publish_date&limit=1` if the API supports it.
40-
FILTERS = f"page_size=1&email_type=public" # Attempt to get just one, the most recent
55+
FILTERS = f"publish_date__start={date_seven_days_ago}&page=1&email_type=public" # Attempt to get just one, the most recent
4156

4257
try:
4358
response = requests.request("GET", f"{BUTTONDOWN_BASE_URL}/v1{BUTTONDOWN_ENDPOINT}?{FILTERS}", headers=headers)

0 commit comments

Comments
 (0)