Repository: ucfopen/canvasapi

Issue:
Warn users that POST requests sent over non-HTTPS may fail
In some cases, Canvas's API responds unpredictably when sending POST requests over HTTP instead of HTTPS.

For example, the `account.create_course` call will return the `GET` response if made over HTTP instead of HTTPS. This breaks `CanvasObject`'s attempts to automatically create an object:

```
>>> a.create_course(course={'name': 'JSA_TST1337_Jesse_McBride'})
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/canvasapi/account.py", line 77, in create_course
    return Course(self._requester, response.json())
  File "/usr/local/lib/python2.7/site-packages/canvasapi/canvas_object.py", line 28, in __init__
    self.set_attributes(attributes)
  File "/usr/local/lib/python2.7/site-packages/canvasapi/canvas_object.py", line 68, in set_attributes
    for attribute, value in attributes.items():
AttributeError: 'list' object has no attribute 'items'
```

It seems wrong to stop users at every POST call if they've set their `CANVAS_URL` to `http://*`. Instead, I think we should hook into `Requester._post_request` and raise a warning that the API call may not succeed.

Discussion:

Patch:
diff --git a/canvasapi/canvas.py b/canvasapi/canvas.py
index ca9a6e8..2e684fa 100644
--- a/canvasapi/canvas.py
+++ b/canvasapi/canvas.py
@@ -39,6 +39,13 @@ class Canvas(object):
                 "Rewriting `base_url` to {}".format(new_url),
                 DeprecationWarning
             )
+
+        if 'http://' in base_url:
+            warnings.warn(
+                "Canvas may respond unexpectedly when making requests to HTTP "
+                "URLs. If possible, please use HTTPS.",
+                UserWarning
+            )
         base_url = new_url + '/api/v1/'
 
         self.__requester = Requester(base_url, access_token)


Test patch:
diff --git a/tests/fixtures/account.json b/tests/fixtures/account.json
index c2675e0..b0a7a13 100644
--- a/tests/fixtures/account.json
+++ b/tests/fixtures/account.json
@@ -204,7 +204,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/accounts/1/courses?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/accounts/1/courses?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -259,7 +259,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/accounts/1/external_tools?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/accounts/1/external_tools?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -319,7 +319,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/accounts/1/groups?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/accounts/1/groups?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"get_groups_context2": {
@@ -403,7 +403,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/accounts/1/reports?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/accounts/1/reports?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -434,7 +434,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/accounts/1/reports/sis_export_csv?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/accounts/1/reports/sis_export_csv?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -467,7 +467,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/accounts/1/sub_accounts?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/accounts/1/sub_accounts?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -510,7 +510,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/accounts/1/users?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/accounts/1/users?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -543,7 +543,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/accounts/1/users/1/account_notifications?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/accounts/1/users/1/account_notifications?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -644,7 +644,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/accounts/1/roles/?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/accounts/1/roles/?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -720,7 +720,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/accounts/1/logins/?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/accounts/1/logins/?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -957,7 +957,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/accounts/1/authentication_providers/?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/accounts/1/authentication_providers/?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
diff --git a/tests/fixtures/assignment.json b/tests/fixtures/assignment.json
index aec1393..0e2f6ba 100644
--- a/tests/fixtures/assignment.json
+++ b/tests/fixtures/assignment.json
@@ -80,7 +80,7 @@
 			"id": 1,
 			"assignment_id": 1,
 			"user_id": 1,
-			"html_url": "http://example.com/courses/1/assignments/1/submissions/1",
+			"html_url": "https://example.com/courses/1/assignments/1/submissions/1",
 			"submission_type": "online_upload"
 		},
 		"status_code": 200
diff --git a/tests/fixtures/authentication_providers.json b/tests/fixtures/authentication_providers.json
index 446fae1..9daf87b 100644
--- a/tests/fixtures/authentication_providers.json
+++ b/tests/fixtures/authentication_providers.json
@@ -15,7 +15,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/accounts/1/authentication_providers/?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/accounts/1/authentication_providers/?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
diff --git a/tests/fixtures/conversation.json b/tests/fixtures/conversation.json
index 3c1bc71..8fe3902 100644
--- a/tests/fixtures/conversation.json
+++ b/tests/fixtures/conversation.json
@@ -32,7 +32,7 @@
         ],
         "status_code": 200,
         "headers": {
-            "Link": "<http://example.com/api/v1/conversations?page=2&per_page=2>; rel=\"next\""
+            "Link": "<https://example.com/api/v1/conversations?page=2&per_page=2>; rel=\"next\""
         }
     },
     "get_conversations_2": {
diff --git a/tests/fixtures/course.json b/tests/fixtures/course.json
index 2c97bd4..da52dd4 100644
--- a/tests/fixtures/course.json
+++ b/tests/fixtures/course.json
@@ -13,7 +13,7 @@
 		"data": {
 			"id": 1,
 			"display_name": "My Blog",
-			"url": "http://example.com/myblog.rss"
+			"url": "https://example.com/myblog.rss"
 		},
 		"status_code": 200
 	},
@@ -62,7 +62,7 @@
 		"data": {
 			"id": 1,
 			"display_name": "My Blog",
-			"url": "http://example.com/myblog.rss"
+			"url": "https://example.com/myblog.rss"
 		},
 		"status_code": 200
 	},
@@ -96,7 +96,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/1/list_assignments?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/1/list_assignments?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"get_all_assignments2": {
@@ -199,7 +199,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/1/external_tools?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/1/external_tools?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -262,7 +262,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/1/recent_students?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/1/recent_students?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -351,7 +351,7 @@
             }
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/1/sections?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/1/sections?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -405,7 +405,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/1/search_users?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/1/search_users?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -443,7 +443,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/1/list_enrollments?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/1/list_enrollments?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"list_enrollments_2": {
@@ -472,12 +472,12 @@
 			{
 				"id": 1,
 				"display_name": "My Blog",
-				"url": "http://example.com/myblog.rss"
+				"url": "https://example.com/myblog.rss"
 			},
 			{
 				"id": 2,
 				"display_name": "My Blog 2",
-				"url": "http://example.com/myblog2.rss"
+				"url": "https://example.com/myblog2.rss"
 			}
 		],
 		"status_code": 200
@@ -490,18 +490,18 @@
 				"id": 1,
 				"size": 2939,
 				"display_name": "File1.txt",
-				"url": "http://example.com/file_download"
+				"url": "https://example.com/file_download"
 			},
 			{
 				"id": 2,
 				"size": 18380,
 				"display_name": "File_2.png",
-				"url": "http://example.com/file_download2"
+				"url": "https://example.com/file_download2"
 			}
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/1/files?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/1/files?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"list_course_files2": {
@@ -512,13 +512,13 @@
 				"id": 3,
 				"display_name": "File 3.jpg",
 				"size": 1298,
-				"url": "http://example.com/file_download3"
+				"url": "https://example.com/file_download3"
 			},
 			{
 				"id": 4,
 				"display_name": "File 4.docx",
 				"size": 88920,
-				"url": "http://example.com/file_download4"
+				"url": "https://example.com/file_download4"
 			}
 		],
 		"status_code": 200
@@ -559,7 +559,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/1/list_quizzes?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/1/list_quizzes?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"list_quizzes2": {
@@ -603,7 +603,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -741,14 +741,14 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/1/list_modules?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/1/list_modules?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"upload": {
 		"method": "POST",
 		"endpoint": "courses/1/files",
 		"data": {
-			"upload_url": "http://example.com/api/v1/files/upload_response_upload_url",
+			"upload_url": "https://example.com/api/v1/files/upload_response_upload_url",
 			"upload_params": {
 				"some_param": "param123",
 				"a_different_param": "param456"
@@ -838,7 +838,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/1/get_pages?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/1/get_pages?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"get_pages2": {
@@ -922,7 +922,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/1/groups?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/1/groups?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"list_groups_context2": {
@@ -1259,14 +1259,14 @@
 				"id": 1,
 				"assignments_id": 1,
 				"user_id": 1,
-				"html_url": "http://example.com/courses/1/assignments/1/submissions/1",
+				"html_url": "https://example.com/courses/1/assignments/1/submissions/1",
 				"submission_type": "online_upload"
 			},
 			{
 				"id": 2,
 				"assignments_id": 1,
 				"user_id": 2,
-				"html_url": "http://example.com/courses/1/assignments/1/submissions/2",
+				"html_url": "https://example.com/courses/1/assignments/1/submissions/2",
 				"submission_type": "online_upload"
 			}
 		],
@@ -1307,7 +1307,7 @@
 				"id": 1,
 				"assignments_id": 1,
 				"user_id": 1,
-				"html_url": "http://example.com/courses/1/assignments/1/submissions/1",
+				"html_url": "https://example.com/courses/1/assignments/1/submissions/1",
 				"submission_type": "online_upload",
 				"excused": true
 		},
diff --git a/tests/fixtures/current_user.json b/tests/fixtures/current_user.json
index 1bc6111..ff86ca8 100644
--- a/tests/fixtures/current_user.json
+++ b/tests/fixtures/current_user.json
@@ -23,7 +23,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/users/self/groups?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/users/self/groups?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"list_groups2": {
diff --git a/tests/fixtures/external_tool.json b/tests/fixtures/external_tool.json
index 1912a62..76d8ac5 100644
--- a/tests/fixtures/external_tool.json
+++ b/tests/fixtures/external_tool.json
@@ -95,7 +95,7 @@
 		"data": {
 			"id": "1",
 			"name": "External Tool #1 (Course)",
-			"url": "http://example.com/courses/1/external_tools/sessionless_launch/?verifier=1337"
+			"url": "https://example.com/courses/1/external_tools/sessionless_launch/?verifier=1337"
 		},
 		"status_code": 200
 	},
diff --git a/tests/fixtures/folder.json b/tests/fixtures/folder.json
index b7c2b00..7d015a0 100644
--- a/tests/fixtures/folder.json
+++ b/tests/fixtures/folder.json
@@ -39,7 +39,7 @@
         ],
         "status_code": 200,
         "headers": {
-            "Link": "<http://example.com/api/v1/folders/1/files?page=2&per_page=2>; rel=\"next\""
+            "Link": "<https://example.com/api/v1/folders/1/files?page=2&per_page=2>; rel=\"next\""
         }
     },
     "list_folder_files2": {
diff --git a/tests/fixtures/group.json b/tests/fixtures/group.json
index 27d2abd..6f08d97 100644
--- a/tests/fixtures/group.json
+++ b/tests/fixtures/group.json
@@ -108,7 +108,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/groups/1/get_pages?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/groups/1/get_pages?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"get_pages2": {
@@ -185,7 +185,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/groups/1/users?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/groups/1/users?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -208,7 +208,7 @@
 		"method": "POST",
 		"endpoint": "groups/1/files",
 		"data": {
-			"upload_url": "http://example.com/api/v1/files/upload_response_upload_url",
+			"upload_url": "https://example.com/api/v1/files/upload_response_upload_url",
 			"upload_params": {
 			    "some_param": "param123",
 			    "a_different_param": "param456"
@@ -271,7 +271,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/groups/1/memberships?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/groups/1/memberships?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -685,7 +685,7 @@
 		"data": {
 			"id": 1,
 			"display_name": "My Blog",
-			"url": "http://example.com/myblog.rss"
+			"url": "https://example.com/myblog.rss"
 		},
 		"status_code": 200
 	},
@@ -696,12 +696,12 @@
 			{
 				"id": 1,
 				"display_name": "My Blog",
-				"url": "http://example.com/myblog.rss"
+				"url": "https://example.com/myblog.rss"
 			},
 			{
 				"id": 2,
 				"display_name": "My Blog 2",
-				"url": "http://example.com/myblog2.rss"
+				"url": "https://example.com/myblog2.rss"
 			}
 		],
         "status_code": 200
@@ -712,7 +712,7 @@
 		"data": {
 			"id": 1,
 			"display_name": "My Blog",
-			"url": "http://example.com/myblog.rss"
+			"url": "https://example.com/myblog.rss"
 		},
 		"status_code": 200
 	},
@@ -733,7 +733,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/groups/1/files?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/groups/1/files?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"list_group_files2": {
diff --git a/tests/fixtures/login.json b/tests/fixtures/login.json
index 3e572bd..8942470 100644
--- a/tests/fixtures/login.json
+++ b/tests/fixtures/login.json
@@ -22,7 +22,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/accounts/1/logins/?page=2&per_page=1>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/accounts/1/logins/?page=2&per_page=1>; rel=\"next\""
 		},
 		"status_code": 200
 	},
diff --git a/tests/fixtures/module.json b/tests/fixtures/module.json
index 9369b5a..c7da4c2 100644
--- a/tests/fixtures/module.json
+++ b/tests/fixtures/module.json
@@ -52,7 +52,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/1/modules/1/items/list_module_items?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/1/modules/1/items/list_module_items?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"list_module_items2": {
diff --git a/tests/fixtures/outcome.json b/tests/fixtures/outcome.json
index 139d684..25a3444 100644
--- a/tests/fixtures/outcome.json
+++ b/tests/fixtures/outcome.json
@@ -69,7 +69,7 @@
             }
         ],
         "headers": {
-            "Link": "<http://example.com/api/v1/accounts/1/outcome_groups?page=2&per_page=2>; rel=\"next\""
+            "Link": "<https://example.com/api/v1/accounts/1/outcome_groups?page=2&per_page=2>; rel=\"next\""
         },
         "status_code": 200
     },
@@ -259,7 +259,7 @@
             }
         ],
         "headers": {
-            "Link": "<http://example.com/api/v1/courses/1/outcome_groups?page=2&per_page=2>; rel=\"next\""
+            "Link": "<https://example.com/api/v1/courses/1/outcome_groups?page=2&per_page=2>; rel=\"next\""
         },
         "status_code": 200
     },
diff --git a/tests/fixtures/page.json b/tests/fixtures/page.json
index c09d753..dac500f 100644
--- a/tests/fixtures/page.json
+++ b/tests/fixtures/page.json
@@ -44,7 +44,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/courses/1/pages/my-url/revisions?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/courses/1/pages/my-url/revisions?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"list_revisions2": {
diff --git a/tests/fixtures/paginated_list.json b/tests/fixtures/paginated_list.json
index 904906d..e37006f 100644
--- a/tests/fixtures/paginated_list.json
+++ b/tests/fixtures/paginated_list.json
@@ -45,7 +45,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/four_objects_two_pages?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/four_objects_two_pages?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -78,7 +78,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/six_objects_three_pages?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/six_objects_three_pages?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -96,7 +96,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/six_objects_three_pages?page=3&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/six_objects_three_pages?page=3&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
diff --git a/tests/fixtures/section.json b/tests/fixtures/section.json
index c4caecb..5c7df15 100644
--- a/tests/fixtures/section.json
+++ b/tests/fixtures/section.json
@@ -37,7 +37,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-            "Link": "<http://example.com/api/v1/sections/1/list_enrollments?page=2&per_page=2>; rel=\"next\""
+            "Link": "<https://example.com/api/v1/sections/1/list_enrollments?page=2&per_page=2>; rel=\"next\""
         }
 	},
 	"list_enrollments_2": {
@@ -101,7 +101,7 @@
 			"id": 1,
 			"assignment_id": 1,
 			"user_id": 1,
-			"html_url": "http://example.com/sections/1/assignments/1/submissions/1",
+			"html_url": "https://example.com/sections/1/assignments/1/submissions/1",
 			"submission_type": "online_upload"
 		},
 		"status_code": 200
@@ -114,14 +114,14 @@
 				"id": 1,
 				"assignments_id": 1,
 				"user_id": 1,
-				"html_url": "http://example.com/sections/1/assignments/1/submissions/1",
+				"html_url": "https://example.com/sections/1/assignments/1/submissions/1",
 				"submission_type": "online_upload"
 			},
 			{
 				"id": 2,
 				"assignments_id": 1,
 				"user_id": 2,
-				"html_url": "http://example.com/sections/1/assignments/1/submissions/2",
+				"html_url": "https://example.com/sections/1/assignments/1/submissions/2",
 				"submission_type": "online_upload"
 			}
 		],
@@ -135,14 +135,14 @@
 				"id": 1,
 				"assignments_id": 1,
 				"user_id": 1,
-				"html_url": "http://example.com/sections/1/assignments/1/submissions/1",
+				"html_url": "https://example.com/sections/1/assignments/1/submissions/1",
 				"submission_type": "online_upload"
 			},
 			{
 				"id": 2,
 				"assignments_id": 1,
 				"user_id": 2,
-				"html_url": "http://example.com/sections/1/assignments/1/submissions/2",
+				"html_url": "https://example.com/sections/1/assignments/1/submissions/2",
 				"submission_type": "online_upload"
 			}
 		],
@@ -155,7 +155,7 @@
 				"id": 1,
 				"assignments_id": 1,
 				"user_id": 1,
-				"html_url": "http://example.com/sections/1/assignments/1/submissions/1",
+				"html_url": "https://example.com/sections/1/assignments/1/submissions/1",
 				"submission_type": "online_upload"
 		},
 		"status_code": 200
@@ -167,7 +167,7 @@
 				"id": 1,
 				"assignments_id": 1,
 				"user_id": 1,
-				"html_url": "http://example.com/sections/1/assignments/1/submissions/1",
+				"html_url": "https://example.com/sections/1/assignments/1/submissions/1",
 				"submission_type": "online_upload",
 				"excused": true
 		},
diff --git a/tests/fixtures/submission.json b/tests/fixtures/submission.json
index 1d18224..f2610b3 100644
--- a/tests/fixtures/submission.json
+++ b/tests/fixtures/submission.json
@@ -6,7 +6,7 @@
 			"id": 1,
 			"assignment_id": 1,
 			"user_id": 1,
-			"html_url": "http://example.com/courses/1/assignments/1/submissions/1",
+			"html_url": "https://example.com/courses/1/assignments/1/submissions/1",
 			"submission_type": "online_upload"
 		},
 		"status_code": 200
@@ -18,7 +18,7 @@
 				"id": 1,
 				"assignment_id": 1,
 				"user_id": 1,
-				"html_url": "http://example.com/sections/1/assignments/1/submissions/1",
+				"html_url": "https://example.com/sections/1/assignments/1/submissions/1",
 				"submission_type": "online_upload"
 		},
 		"status_code": 200
@@ -31,14 +31,14 @@
 				"id": 1,
 				"assignments_id": 1,
 				"user_id": 1,
-				"html_url": "http://example.com/courses/1/assignments/1/submissions/1",
+				"html_url": "https://example.com/courses/1/assignments/1/submissions/1",
 				"submission_type": "online_upload"
 			},
 			{
 				"id": 2,
 				"assignments_id": 1,
 				"user_id": 2,
-				"html_url": "http://example.com/courses/1/assignments/1/submissions/2",
+				"html_url": "https://example.com/courses/1/assignments/1/submissions/2",
 				"submission_type": "online_upload"
 			}
 		],
@@ -48,7 +48,7 @@
 		"method": "POST",
 		"endpoint": "courses/1/assignments/1/submissions/1/comments/files",
 		"data": {
-			"upload_url": "http://example.com/api/v1/files/upload_response_upload_url",
+			"upload_url": "https://example.com/api/v1/files/upload_response_upload_url",
 			"upload_params": {
 				"some_param": "param123",
 				"a_different_param": "param456"
@@ -70,7 +70,7 @@
 				"id": 1,
 				"assignments_id": 1,
 				"user_id": 1,
-				"html_url": "http://example.com/courses/1/assignments/1/submissions/1",
+				"html_url": "https://example.com/courses/1/assignments/1/submissions/1",
 				"submission_type": "online_upload",
 				"excused": true
 		},
diff --git a/tests/fixtures/uploader.json b/tests/fixtures/uploader.json
index efcdb10..ccea364 100644
--- a/tests/fixtures/uploader.json
+++ b/tests/fixtures/uploader.json
@@ -3,7 +3,7 @@
         "method": "POST",
         "endpoint": "upload_response",
         "data": {
-            "upload_url": "http://example.com/api/v1/upload_response_upload_url",
+            "upload_url": "https://example.com/api/v1/upload_response_upload_url",
             "upload_params": {
                 "some_param": "param123",
                 "a_different_param": "param456"
@@ -35,7 +35,7 @@
         "method": "POST",
         "endpoint": "upload_response_fail",
         "data": {
-            "upload_url": "http://example.com/api/v1/upload_fail",
+            "upload_url": "https://example.com/api/v1/upload_fail",
             "upload_params": {
                 "some_param": "param123",
                 "a_different_param": "param456"
diff --git a/tests/fixtures/user.json b/tests/fixtures/user.json
index 4aa36b0..3f9bb01 100644
--- a/tests/fixtures/user.json
+++ b/tests/fixtures/user.json
@@ -32,7 +32,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/users/1/avatars?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/users/1/avatars?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -117,7 +117,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/users/self/course_nicknames?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/users/self/course_nicknames?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"course_nicknames_delete": {
@@ -161,7 +161,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/users/1/courses?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/users/1/courses?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -287,7 +287,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/users/1/courses/1/list_assignments?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/users/1/courses/1/list_assignments?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"get_user_assignments2": {
@@ -326,7 +326,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/users/1/files?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/users/1/files?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"get_user_files2": {
@@ -386,7 +386,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/users/1/communication_channels?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/users/1/communication_channels?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"list_comm_channels2": {
@@ -427,7 +427,7 @@
 		],
 		"status_code": 200,
 		"headers": {
-			"Link": "<http://example.com/api/v1/users/1/list_enrollments?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/users/1/list_enrollments?page=2&per_page=2>; rel=\"next\""
 		}
 	},
 	"list_enrollments_2": {
@@ -490,7 +490,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/users/1/missing_submissions?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/users/1/missing_submissions?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -517,19 +517,19 @@
 		"data": [
 			{
 				"id": "123fb561-c9ce-7ed9-8e42-31e0aab47e18",
-				"url": "http://example.com/test",
+				"url": "https://example.com/test",
 				"created_at": "2013-01-01T12:00:00Z",
 				"context_type": "Course"
 			},
 			{
 				"id": "4c7f44f9-41b9-ff59-03ad-3215cb246966",
-				"url": "http://example.com/hello",
+				"url": "https://example.com/hello",
 				"created_at": "2014-01-01T12:00:00Z",
 				"context_type": "User"
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/users/1/page_views?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/users/1/page_views?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -539,13 +539,13 @@
 		"data": [
 			{
 				"id": "77f111c9-5b0b-46cb-92a2-34108ebe7b5b",
-				"url": "http://example.com/login",
+				"url": "https://example.com/login",
 				"created_at": "2015-01-01T12:00:00Z",
 				"context_type": null
 			},
 			{
 				"id": "69ec8b6f-e123-2af8-dafb-561fdc711f6b",
-				"url": "http://example.com/logout",
+				"url": "https://example.com/logout",
 				"created_at": "2016-01-01T12:00:00Z",
 				"context_type": "UserProfile"
 			}
@@ -620,7 +620,7 @@
 		"method": "POST",
 		"endpoint": "users/1/files",
 		"data": {
-			"upload_url": "http://example.com/api/v1/files/upload_response_upload_url",
+			"upload_url": "https://example.com/api/v1/files/upload_response_upload_url",
 			"upload_params": {
 				"some_param": "param123",
 				"a_different_param": "param456"
@@ -649,7 +649,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/users/1/logins/?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/users/1/logins/?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
@@ -683,7 +683,7 @@
 			}
 		],
 		"headers": {
-			"Link": "<http://example.com/api/v1/users/1/observees?page=2&per_page=2>; rel=\"next\""
+			"Link": "<https://example.com/api/v1/users/1/observees?page=2&per_page=2>; rel=\"next\""
 		},
 		"status_code": 200
 	},
diff --git a/tests/settings.py b/tests/settings.py
index e67c5f6..ad1593f 100644
--- a/tests/settings.py
+++ b/tests/settings.py
@@ -1,7 +1,8 @@
 from __future__ import absolute_import, division, print_function, unicode_literals
 
-BASE_URL = 'http://example.com'
-BASE_URL_WITH_VERSION = 'http://example.com/api/v1/'
+BASE_URL = 'https://example.com'
+BASE_URL_WITH_VERSION = 'https://example.com/api/v1/'
+BASE_URL_AS_HTTP = 'http://example.com'
 API_KEY = '123'
 
 INVALID_ID = 9001
diff --git a/tests/test_canvas.py b/tests/test_canvas.py
index 058bb46..4af23e9 100644
--- a/tests/test_canvas.py
+++ b/tests/test_canvas.py
@@ -40,6 +40,12 @@ class TestCanvas(unittest.TestCase):
             Canvas(settings.BASE_URL_WITH_VERSION, settings.API_KEY)
             self.assertTrue(issubclass(w[0].category, DeprecationWarning))
 
+    # Canvas()
+    def test_init_warns_when_url_is_http(self, m):
+        with warnings.catch_warnings(record=True) as w:
+            Canvas(settings.BASE_URL_AS_HTTP, settings.API_KEY)
+            self.assertTrue(issubclass(w[0].category, UserWarning))
+
     # create_account()
     def test_create_account(self, m):
         register_uris({'account': ['create']}, m)
diff --git a/tests/test_course.py b/tests/test_course.py
index 5e679eb..667c05b 100644
--- a/tests/test_course.py
+++ b/tests/test_course.py
@@ -1029,7 +1029,7 @@ class TestCourse(unittest.TestCase):
     def test_create_external_feed(self, m):
         register_uris({'course': ['create_external_feed']}, m)
 
-        url_str = "http://example.com/myblog.rss"
+        url_str = "https://example.com/myblog.rss"
         response = self.course.create_external_feed(url=url_str)
         self.assertIsInstance(response, ExternalFeed)
 
diff --git a/tests/test_group.py b/tests/test_group.py
index ade9c8e..4a41acc 100644
--- a/tests/test_group.py
+++ b/tests/test_group.py
@@ -419,7 +419,7 @@ class TestGroup(unittest.TestCase):
     def test_create_external_feed(self, m):
         register_uris({'group': ['create_external_feed']}, m)
 
-        url_str = "http://example.com/myblog.rss"
+        url_str = "https://example.com/myblog.rss"
         response = self.group.create_external_feed(url=url_str)
         self.assertIsInstance(response, ExternalFeed)