Commit 45f38ddf by David Baumgold

Update `requests` library to 1.2.3

parent 54343881
...@@ -12,7 +12,7 @@ from django.core.management import call_command ...@@ -12,7 +12,7 @@ from django.core.management import call_command
from django.conf import settings from django.conf import settings
from selenium.common.exceptions import WebDriverException from selenium.common.exceptions import WebDriverException
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from requests import put import requests
from base64 import encodestring from base64 import encodestring
from json import dumps from json import dumps
...@@ -54,12 +54,12 @@ def set_job_status(jobid, passed=True): ...@@ -54,12 +54,12 @@ def set_job_status(jobid, passed=True):
""" """
Sets the job status on sauce labs Sets the job status on sauce labs
""" """
body_content = dumps({"passed": passed})
config = get_username_and_key() 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] base64string = encodestring('{}:{}'.format(config['username'], config['access-key']))[:-1]
result = put('http://saucelabs.com/rest/v1/{}/jobs/{}'.format(config['username'], world.jobid), headers = {"Authorization": "Basic {}".format(base64string)}
data=body_content, result = requests.put(url, data=body_content, headers=headers)
headers={"Authorization": "Basic {}".format(base64string)})
return result.status_code == 200 return result.status_code == 200
......
...@@ -64,7 +64,8 @@ class XQueueInterface(object): ...@@ -64,7 +64,8 @@ class XQueueInterface(object):
def __init__(self, url, django_auth, requests_auth=None): def __init__(self, url, django_auth, requests_auth=None):
self.url = url self.url = url
self.auth = django_auth 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): def send_to_queue(self, header, body, files_to_upload=None):
""" """
......
...@@ -39,7 +39,7 @@ username = prompt('username on server', 'victor@edx.org') ...@@ -39,7 +39,7 @@ username = prompt('username on server', 'victor@edx.org')
password = prompt('password', 'abc123', safe=True) password = prompt('password', 'abc123', safe=True)
print "get csrf cookie" print "get csrf cookie"
session = requests.session() session = requests.Session()
r = session.get(server + '/') r = session.get(server + '/')
r.raise_for_status() r.raise_for_status()
......
...@@ -25,7 +25,7 @@ class GradingService(object): ...@@ -25,7 +25,7 @@ class GradingService(object):
def __init__(self, config): def __init__(self, config):
self.username = config['username'] self.username = config['username']
self.password = config['password'] self.password = config['password']
self.session = requests.session() self.session = requests.Session()
self.system = config['system'] self.system = config['system']
def _login(self): def _login(self):
......
...@@ -48,7 +48,7 @@ python-memcached==1.48 ...@@ -48,7 +48,7 @@ python-memcached==1.48
python-openid==2.2.5 python-openid==2.2.5
pytz==2012h pytz==2012h
PyYAML==3.10 PyYAML==3.10
requests==0.14.2 requests==1.2.3
Shapely==1.2.16 Shapely==1.2.16
sorl-thumbnail==11.12 sorl-thumbnail==11.12
South==0.7.6 South==0.7.6
......
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
import urlparse import urlparse
from requests.packages.oauthlib.oauth1.rfc5849 import signature
import mock import mock
import threading import threading
import json import json
......
...@@ -4,6 +4,7 @@ Unit tests for instructor.api methods. ...@@ -4,6 +4,7 @@ Unit tests for instructor.api methods.
# pylint: disable=E1111 # pylint: disable=E1111
import unittest import unittest
import json import json
import requests
from urllib import quote from urllib import quote
from django.conf import settings from django.conf import settings
from django.test import TestCase from django.test import TestCase
...@@ -756,7 +757,7 @@ class TestInstructorAPIAnalyticsProxy(ModuleStoreTestCase, LoginEnrollmentTestCa ...@@ -756,7 +757,7 @@ class TestInstructorAPIAnalyticsProxy(ModuleStoreTestCase, LoginEnrollmentTestCa
class FakeProxyResponse(object): class FakeProxyResponse(object):
""" Fake successful requests response object. """ """ Fake successful requests response object. """
def __init__(self): 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"}' self.content = '{"test_content": "robot test content"}'
class FakeBadProxyResponse(object): class FakeBadProxyResponse(object):
......
...@@ -9,7 +9,6 @@ Many of these GETs may become PUTs in the future. ...@@ -9,7 +9,6 @@ Many of these GETs may become PUTs in the future.
import re import re
import logging import logging
import requests import requests
from requests.status_codes import codes
from collections import OrderedDict from collections import OrderedDict
from django.conf import settings from django.conf import settings
from django_future.csrf import ensure_csrf_cookie from django_future.csrf import ensure_csrf_cookie
......
...@@ -53,7 +53,7 @@ python-memcached==1.48 ...@@ -53,7 +53,7 @@ python-memcached==1.48
python-openid==2.2.5 python-openid==2.2.5
pytz==2012h pytz==2012h
PyYAML==3.10 PyYAML==3.10
requests==0.14.2 requests==1.2.3
scipy==0.11.0 scipy==0.11.0
Shapely==1.2.16 Shapely==1.2.16
sorl-thumbnail==11.12 sorl-thumbnail==11.12
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment