After a bit of head banging we called our Canvas CSM who was able to help with the 'do_course_copy.py' script mentioned above. He said "don't use it!" Ha ha! I knew that....
What we did was write a different Python script to use a different API specifically for migration - which was exactly what we needed. Here is what we ended up with.
The Canvas api we used: POST /api/v1/courses/:course_id/content_migrations
I set up all the required variables::
domain = 'your_https_url.instructure.com'
api_prefix = '/api/v1/courses/'
api_suffix = '/content_migrations'
source_course = 'sis_course_id:course_template_201740' ## this is the </:course_id/> listed in the API
c_list_file = './test_course_ids.csv' ## a CSV list of courses you want to apply the migration to with a header row labeled 'course_id' ...
token = <token>
headers = { 'Authorization': 'Bearer %s' % token, }
querystring = {'settings[source_course_id]': source_course,'migration_type':'course_copy_importer'}
## apply migration loop
if __name__ == '__main__':
with open(c_list_file, 'r') as f:
reader = csv.DictReader(f)
for row in reader:
course_id = row['course_id']
url2 = (domain + api_prefix + course_id + api_suffix)
response = requests.post(url2, headers=headers, params=querystring)
I hope someone can use it.
But HEY! No guarantees right??