Here's the python code:
with open('config.json') as json_data_file:
configuration = json.load(json_data_file)
access_token=configuration["canvas"]["access_token"]
baseUrl="https://"+configuration["canvas"]["host"]+"/api/v1/courses/"
header = {'Authorization' : 'Bearer ' + access_token}
I'm trying to write some code in ruby that does the exact same thing as the python code above. This is how I wrote it:
File.open("config.json") {|json_data_file|
configuration = json.load(json_data_file)
access_token=configuration["canvas"]["access_token"]
baseUrl="https://"+configuration["canvas"]["host"]+"/api/v1/courses/"
}
header = {'Authorization': 'Bearer ' + access_token}
Is this the correct way to do it?