Skip to content

Instantly share code, notes, and snippets.

@akatreyt
Created November 8, 2014 18:49
Show Gist options
  • Save akatreyt/6612d0f57657a9c1f0cb to your computer and use it in GitHub Desktop.
Save akatreyt/6612d0f57657a9c1f0cb to your computer and use it in GitHub Desktop.
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