<s> import urllib2 <EOL> import logging <EOL> import json <EOL> import wevote_functions . admin <EOL> logger = wevote_functions . admin . get_logger ( __name__ ) <EOL> class FacebookAPI ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , social_user ) : <EOL> self . social_user = social_user <EOL> def fetch_friends ( self ) : <EOL> request = self . _request ( ) <EOL> friends = [ ] <EOL> try : <EOL> friends = json . loads ( urllib2 . urlopen ( request ) . read ( ) ) . get ( '<STR_LIT:data>' ) <EOL> except Exception , err : <EOL> logger . error ( err ) <EOL> return friends <EOL> def profile_url ( self ) : <EOL> return u'<STR_LIT>' . format ( self . social_user . uid ) <EOL> def _request ( self , ** params ) : <EOL> url = u'<STR_LIT>' u'<STR_LIT>' u'<STR_LIT>' . format ( <EOL> self . social_user . uid , <EOL> self . social_user . extra_data [ '<STR_LIT>' ] , <EOL> ) <EOL> request = urllib2 . Request ( url ) <EOL> return request </s>
