File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -65,16 +65,16 @@ def build_authenticate_header(realm=''):
65
65
66
66
def build_xoauth_string (url , consumer , token = None ):
67
67
"""Build an XOAUTH string for use in SMTP/IMPA authentication."""
68
- request = oauth . Request .from_consumer_and_token (consumer , token ,
68
+ request = Request .from_consumer_and_token (consumer , token ,
69
69
"GET" , url )
70
70
71
- signing_method = oauth . SignatureMethod_HMAC_SHA1 ()
71
+ signing_method = SignatureMethod_HMAC_SHA1 ()
72
72
request .sign_request (signing_method , consumer , token )
73
73
74
74
params = []
75
75
for k ,v in sorted (request .iteritems ()):
76
76
if v is not None :
77
- params .append ('%s="%s"' % (k , oauth . escape (v )))
77
+ params .append ('%s="%s"' % (k , escape (v )))
78
78
79
79
return "%s %s %s" % ("GET" , url , ',' .join (params ))
80
80
File renamed without changes.
Original file line number Diff line number Diff line change 1
1
import oauth2
2
2
import smtplib
3
+ import base64
3
4
4
- class SMTP (smtplib .SMTP , oauth2 .XOAuth ):
5
+
6
+ class SMTP (smtplib .SMTP ):
5
7
def authenticate (self , url , consumer , token ):
6
8
if consumer is not None and not isinstance (consumer , oauth2 .Consumer ):
7
9
raise ValueError ("Invalid consumer." )
8
10
9
11
if token is not None and not isinstance (token , oauth2 .Token ):
10
12
raise ValueError ("Invalid token." )
11
13
12
- smtp_conn .docmd ('AUTH' , 'XOAUTH %s' + \
13
- base64 .b64encode (oauth2 .build_xoauth_string (url , consumer , token ))
14
+ self .docmd ('AUTH' , 'XOAUTH %s' + \
15
+ base64 .b64encode (oauth2 .build_xoauth_string (url , consumer , token )))
14
16
You can’t perform that action at this time.
0 commit comments