<s> from __future__ import print_function <EOL> from smugpy import SmugMug <EOL> import sys <EOL> if sys . version_info < ( <NUM_LIT:3> , ) : <EOL> get_input = raw_input <EOL> else : <EOL> get_input = input <EOL> API_KEY = "<STR_LIT>" <EOL> OAUTH_SECRET = "<STR_LIT>" <EOL> APP_NAME = "<STR_LIT>" <EOL> def smugmugOauthRequestToken ( access = "<STR_LIT>" , perm = "<STR_LIT>" ) : <EOL> smugmug = SmugMug ( api_key = API_KEY , oauth_secret = OAUTH_SECRET , app_name = APP_NAME ) <EOL> response = smugmug . auth_getRequestToken ( ) <EOL> url = smugmug . authorize ( access = access , perm = perm ) <EOL> return url , response [ '<STR_LIT>' ] <EOL> def userAuthorizeAtSmugmug ( url ) : <EOL> get_input ( "<STR_LIT>" % ( url ) ) <EOL> def smugmugOauthGetAccessToken ( requestToken ) : <EOL> smugmug = SmugMug ( api_key = API_KEY , oauth_secret = OAUTH_SECRET , <EOL> oauth_token = requestToken [ '<STR_LIT>' ] [ '<STR_LIT:id>' ] , <EOL> oauth_token_secret = requestToken [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> app_name = APP_NAME ) <EOL> response = smugmug . auth_getAccessToken ( ) <EOL> return response [ '<STR_LIT>' ] ; <EOL> def smugmugOauthUseAccessToken ( accessToken ) : <EOL> smugmug = SmugMug ( api_key = API_KEY , oauth_secret = OAUTH_SECRET , <EOL> oauth_token = accessToken [ '<STR_LIT>' ] [ '<STR_LIT:id>' ] , <EOL> oauth_token_secret = accessToken [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> app_name = APP_NAME ) <EOL> return smugmug ; <EOL> ( url , requestToken ) = smugmugOauthRequestToken ( ) <EOL> userAuthorizeAtSmugmug ( url ) <EOL> accessToken = smugmugOauthGetAccessToken ( requestToken ) <EOL> smugmug = smugmugOauthUseAccessToken ( accessToken ) <EOL> albums = smugmug . albums_get ( NickName = accessToken [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> for album in albums [ "<STR_LIT>" ] : <EOL> print ( "<STR_LIT>" % ( album [ "<STR_LIT:id>" ] , album [ "<STR_LIT>" ] ) ) </s>
