8000 Update httplib2_client to do preemptive auth · sangsiri/twilio-python@25f6670 · GitHub
[go: up one dir, main page]

Skip to content

Commit 25f6670

Browse files
author
matt
committed
Update httplib2_client to do preemptive auth
1 parent 51fa45e commit 25f6670

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

twilio/http/httplib2_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
from base64 import b64encode
2+
13
import httplib2
2-
from six import integer_types, string_types, iteritems
34
from six import binary_type
5+
from six import integer_types, string_types, iteritems
46

57
from twilio.compat import urlencode, urlparse
68
from twilio.http import get_cert_file, HttpClient
@@ -45,7 +47,8 @@ def request(self,
4547
http.follow_redirects = allow_redirects
4648

4749
if auth is not None:
48-
http.add_credentials(auth[0], auth[1])
50+
headers = headers or {}
51+
headers["Authorization"] = "Basic {}".format(b64encode(':'.join(auth)))
4952

5053
if data is not None:
5154
udata = {}

0 commit comments

Comments
 (0)
0