import social_media_api_client
from datetime import datetime, timedelta
# Authenticate with the social media platform (API key/token)
client = social_media_api_client.authenticate(api_key="YOUR_API_KEY", secret="YOUR_SECRET")
# Define the post content
post_text = "Check out our new product launch! #NewProduct #Innovation"
image_url = "https://yourwebsite.com/images/new_product.jpg"
# Schedule the post for tomorrow at 10 AM Bhaluka time (relative to current time)
scheduled_time = datetime.now() + timedelta(days=1)
scheduled_time = scheduled_time.replace(hour=10, minute=0, second=0, microsecond=0)
try:
# Use the API to schedule the post
response = client.schedule_post(
platform="instagram",
text=post_text,
image=image_url,
schedule=scheduled_time.isoformat()
)
print(f"Post scheduled successfully! Response: {response}")
except Exception as e:
print(f"Error scheduling post: {e}")