This Python script automates the process of creating draft podcast episodes in Transistor from a CSV file. The script reads episode data (titles and summaries) from a CSV file and uses the Transistor API to create each episode as a draft in your Transistor account.
- CSV File Parsing: The script begins by reading a CSV file specified by csv_file_path. This file should contain the episode titles and summaries. It's expected that the first row of the CSV file is a header row, which the script skips.
- Creating Episode Objects: For each row in the CSV file, the script extracts the title and summary, ensuring that both are present. It then creates an episode object containing this data, along with the show ID (show_id).
- Interacting with the Transistor API: The script sends a POST request to the Transistor API for each episode object. The API endpoint (api_url) is set to "https://api.transistor.fm/v1/episodes".
- API Authentication: The script uses an API key (api_key) for authentication. This key should be obtained from your Transistor account and replaced in the script.
- Error Handling and Feedback: After each API request, the script checks the response. If the episode is created successfully (HTTP status code 201), a success message is printed. Otherwise, an error message with the status code and response details is printed.
- Before running the script, ensure that you replace api_key, show_id, and csv_file_path with your actual API key, show ID, and the path to your CSV file, respectively.
- The CSV file should have two columns: one for the episode title and the other for the summary. Ensure that this format is maintained for the script to work correctly.