Created
November 8, 2014 18:49
-
-
Save akatreyt/6612d0f57657a9c1f0cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class get_contact_list(APIView): | |
def get(self, request, *args, **kwargs): | |
print "here" | |
social_user = request.user.social_auth.filter( provider='twitter', ).first() | |
if social_user: | |
url = 'https://api.twitter.com/1.1/friends/list.json'.format(social_user.extra_data['access_token'],) | |
print social_user.extra_data['access_token'] | |
request = urlopen(url) | |
friends = json.loads(urllib2.urlopen(request).read()).get('data') | |
for friend in friends: | |
print friend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment