board_id = get_board_id(pinterest, USERNAME, BOARD_NAME)
if not board_id:
print(f"Board '{BOARD_NAME}' not found.")
return
response = pinterest.pin(
board_id=board_id,
image_path='IMAGE_PATH',
description=PIN_DESCRIPTION,
title=PIN_TITLE,
link=PIN_LINK
)
if response and 'id' in response:
pin_id = response['id']
print(f"Pin created successfully! Pin ID: {pin_id}")
else:
print("Failed to create the pin.")
if name == 'main':
upload_pin()
I got an error that unexpected keyword ( image_path )? can you help me please ?
from datetime import datetime from py3pin.Pinterest import Pinterest import config
EMAIL = config.EMAIL PASSWORD = config.PASSWORD USERNAME = config.USERNAME CRED_ROOT = "cred_root"
BOARD_NAME = 'Morocco' IMAGE_PATH = 'Images/morocco.jpg'
PIN_DESCRIPTION = 'Discover the beauty of Morocco!' PIN_TITLE = 'Morocco' PIN_LINK = 'https://example.com/morocco-tour'
def get_board_id(pinterest, username, board_name): boards = pinterest.boards(username=username) for board in boards: if board['name'].lower() == board_name.lower(): return board['id'] return None
def upload_pin(): pinterest = Pinterest(email=EMAIL, password=PASSWORD, username=USERNAME, cred_root=CRED_ROOT) pinterest.login()
if name == 'main': upload_pin()
I got an error that unexpected keyword ( image_path )? can you help me please ?