@@ -1177,8 +1177,10 @@ def _refresh(self, request):
11771177 'user-agent' : self .user_agent ,
11781178 }
11791179
1180- http_request = atom .http_core .HttpRequest (uri = self .token_uri , method = 'POST' , headers = headers )
1181- http_request .add_body_part (body , mime_type = 'application/x-www-form-urlencoded' )
1180+ http_request = atom .http_core .HttpRequest (
1181+ uri = self .token_uri , method = 'POST' , headers = headers )
1182+ http_request .add_body_part (
1183+ body , mime_type = 'application/x-www-form-urlencoded' )
11821184 response = request (http_request )
11831185 body = response .read ()
11841186 if response .status == 200 :
@@ -1197,16 +1199,19 @@ def _extract_tokens(self, body):
11971199 else :
11981200 self .token_expiry = None
11991201
1200- def generate_authorize_url (self , redirect_uri = 'oob' , response_type = 'code' , ** kwargs ):
1202+ def generate_authorize_url (self , redirect_uri = 'oob' , response_type = 'code' ,
1203+ access_type = 'offline' , ** kwargs ):
12011204 """Returns a URI to redirect to the provider.
12021205
12031206 Args:
1204- redirect_uri: string, Either the string 'oob' for a non-web-based
1205- application, or a URI that handles the callback from
1206- the authorization server.
1207- response_type: string, Either the string 'code' for server-side or
1208- native application, or the string 'token' for client-
1209- side application.
1207+ redirect_uri: Either the string 'oob' for a non-web-based application, or
1208+ a URI that handles the callback from the authorization
1209+ server.
1210+ response_type: Either the string 'code' for server-side or native
1211+ application, or the string 'token' for client-side
1212+ application.
1213+ access_type: Either the string 'offline' to request a refresh token or
1214+ 'online'.
12101215
12111216 If redirect_uri is 'oob' then pass in the
12121217 generated verification code to get_access_token,
@@ -1223,6 +1228,7 @@ def generate_authorize_url(self, redirect_uri='oob', response_type='code', **kwa
12231228 'client_id' : self .client_id ,
12241229 'redirect_uri' : redirect_uri ,
12251230 'scope' : self .scope ,
1231+ 'access_type' : access_type
12261232 }
12271233 query .update (kwargs )
12281234 parts = list (urlparse .urlparse (self .auth_uri ))
0 commit comments