import time
from datetime import datetime, time as time_obj
import schedule
import your_posting_function # Replace with your actual posting function
def post_at_time(post_content, post_time):
"""Posts the given content at the specified time."""
now = datetime.now().time()
if now >= post_time:
print(f"Posting now: {post_content}")
your_posting_function(post_content) # Call your posting function
else:
print(f"Waiting for {post_time} to post: {post_content}")
schedule.run_pending() # Run any pending jobs
# Example usage
post_content = "This is my scheduled post!"
post_time = time_obj(hour=10, minute=30) # Set your desired post time
# Schedule the post
schedule.every().day.at(post_time.strftime("%H:%M")).do(post_at_time, post_content, post_time)
while True:
schedule.run_pending()
time.sleep(1)