diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 498197b590..a554a34f19 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -12,7 +12,7 @@ from django.core.management import call_command from django.conf import settings from selenium.common.exceptions import WebDriverException from selenium.webdriver.common.desired_capabilities import DesiredCapabilities -from requests import put +import requests from base64 import encodestring from json import dumps @@ -54,12 +54,12 @@ def set_job_status(jobid, passed=True): """ Sets the job status on sauce labs """ - body_content = dumps({"passed": passed}) config = get_username_and_key() + url = 'http://saucelabs.com/rest/v1/{}/jobs/{}'.format(config['username'], world.jobid) + body_content = dumps({"passed": passed}) base64string = encodestring('{}:{}'.format(config['username'], config['access-key']))[:-1] - result = put('http://saucelabs.com/rest/v1/{}/jobs/{}'.format(config['username'], world.jobid), - data=body_content, - headers={"Authorization": "Basic {}".format(base64string)}) + headers = {"Authorization": "Basic {}".format(base64string)} + result = requests.put(url, data=body_content, headers=headers) return result.status_code == 200 diff --git a/common/lib/capa/capa/xqueue_interface.py b/common/lib/capa/capa/xqueue_interface.py index 4da8e11d53..81a221961d 100644 --- a/common/lib/capa/capa/xqueue_interface.py +++ b/common/lib/capa/capa/xqueue_interface.py @@ -64,7 +64,8 @@ class XQueueInterface(object): def __init__(self, url, django_auth, requests_auth=None): self.url = url self.auth = django_auth - self.session = requests.session(auth=requests_auth) + self.session = requests.Session() + self.session.auth = requests_auth def send_to_queue(self, header, body, files_to_upload=None): """ diff --git a/common/lib/sample-post.py b/common/lib/sample-post.py index a4985689bf..d035d40709 100644 --- a/common/lib/sample-post.py +++ b/common/lib/sample-post.py @@ -39,7 +39,7 @@ username = prompt('username on server', 'victor@edx.org') password = prompt('password', 'abc123', safe=True) print "get csrf cookie" -session = requests.session() +session = requests.Session() r = session.get(server + '/') r.raise_for_status() diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/grading_service_module.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/grading_service_module.py index 4c6a79a5f1..3a107d51c1 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/grading_service_module.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/grading_service_module.py @@ -25,7 +25,7 @@ class GradingService(object): def __init__(self, config): self.username = config['username'] self.password = config['password'] - self.session = requests.session() + self.session = requests.Session() self.system = config['system'] def _login(self): diff --git a/docs/shared/requirements.txt b/docs/shared/requirements.txt index 7dc7da8a75..6504319c0d 100644 --- a/docs/shared/requirements.txt +++ b/docs/shared/requirements.txt @@ -48,7 +48,7 @@ python-memcached==1.48 python-openid==2.2.5 pytz==2012h PyYAML==3.10 -requests==0.14.2 +requests==1.2.3 Shapely==1.2.16 sorl-thumbnail==11.12 South==0.7.6 diff --git a/lms/djangoapps/courseware/mock_youtube_server/mock_youtube_server.py b/lms/djangoapps/courseware/mock_youtube_server/mock_youtube_server.py index 46b269dda6..16ab36b6f7 100644 --- a/lms/djangoapps/courseware/mock_youtube_server/mock_youtube_server.py +++ b/lms/djangoapps/courseware/mock_youtube_server/mock_youtube_server.py @@ -1,6 +1,5 @@ from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler import urlparse -from requests.packages.oauthlib.oauth1.rfc5849 import signature import mock import threading import json diff --git a/lms/djangoapps/instructor/tests/test_api.py b/lms/djangoapps/instructor/tests/test_api.py index 7d55b001d0..cd0b230423 100644 --- a/lms/djangoapps/instructor/tests/test_api.py +++ b/lms/djangoapps/instructor/tests/test_api.py @@ -4,6 +4,7 @@ Unit tests for instructor.api methods. # pylint: disable=E1111 import unittest import json +import requests from urllib import quote from django.conf import settings from django.test import TestCase @@ -756,7 +757,7 @@ class TestInstructorAPIAnalyticsProxy(ModuleStoreTestCase, LoginEnrollmentTestCa class FakeProxyResponse(object): """ Fake successful requests response object. """ def __init__(self): - self.status_code = instructor.views.api.codes.OK + self.status_code = requests.status_codes.codes.OK self.content = '{"test_content": "robot test content"}' class FakeBadProxyResponse(object): diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py index e5498585a3..2fcc953e52 100644 --- a/lms/djangoapps/instructor/views/api.py +++ b/lms/djangoapps/instructor/views/api.py @@ -9,7 +9,6 @@ Many of these GETs may become PUTs in the future. import re import logging import requests -from requests.status_codes import codes from collections import OrderedDict from django.conf import settings from django_future.csrf import ensure_csrf_cookie diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 77fbe40ecc..61c98bf419 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -53,7 +53,7 @@ python-memcached==1.48 python-openid==2.2.5 pytz==2012h PyYAML==3.10 -requests==0.14.2 +requests==1.2.3 scipy==0.11.0 Shapely==1.2.16 sorl-thumbnail==11.12