-
Notifications
You must be signed in to change notification settings - Fork 1
/
get_user_info.py
28 lines (23 loc) · 1 KB
/
get_user_info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# import get_id files
from get_id import *
# get_user_info() function
def get_user_info(insta_username):
user_id = get_user_id(insta_username)
if user_id == None:
print 'User does not exist!'
exit()
request_url = (BASE_URL + 'users/%s?access_token=%s') % (user_id, APP_ACCESS_TOKEN)
print 'GET request url : %s' % (request_url)
user_info = requests.get(request_url).json()
if user_info['meta']['code'] == 200:
if len(user_info['data']):
print 'Username: %s' % (user_info['data']['username'])
print 'No. of followers: %s' % (user_info['data']['counts']['followed_by'])
print 'No. of people you are following: %s' % (user_info['data']['counts']['follows'])
print 'No. of posts: %s' % (user_info['data']['counts']['media'])
else:
print 'There is no data for this user!'
else:
print 'Status code other than 200 received!'
# calling the get_user_info function
# get_user_info(raw_input("enter"))