Skip to content

Commit

Permalink
Added functionality for Follow Requests
Browse files Browse the repository at this point in the history
Added the ability to get pending follow requests, approve or deny
any pending follow reauestst. These are useful only on private
Instagram accounts.
  • Loading branch information
jamesbrink committed Jan 16, 2018
1 parent 8267060 commit 56693ad
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
25 changes: 23 additions & 2 deletions InstagramAPI/InstagramAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,10 +583,10 @@ def editProfile(self, url, phone, first_name, biography, email, gender):
'email': email,
'gender': gender})
return self.SendRequest('accounts/edit_profile/', self.generateSignature(data))

def getStory(self, usernameId):
return self.SendRequest('feed/user/' + str(usernameId) + '/reel_media/')

def getUsernameInfo(self, usernameId):
return self.SendRequest('users/' + str(usernameId) + '/info/')

Expand Down Expand Up @@ -706,6 +706,9 @@ def getUserFollowers(self, usernameId, maxid=''):
def getSelfUserFollowers(self):
return self.getUserFollowers(self.username_id)

def getPendingFollowRequests(self):
return self.SendRequest('friendships/pending?')

def like(self, mediaId):
data = json.dumps({'_uuid': self.uuid,
'_uid': self.username_id,
Expand Down Expand Up @@ -738,6 +741,24 @@ def backup(self):
# TODO Instagram.php 1470-1485
return False

def approve(self, userId):
data = json.dumps({
'_uuid' : self.uuid,
'_uid' : self.username_id,
'user_id' : userId,
'_csrftoken' : self.token
})
return self.SendRequest('friendships/approve/'+ str(userId) + '/', self.generateSignature(data))

def ignore(self, userId):
data = json.dumps({
'_uuid' : self.uuid,
'_uid' : self.username_id,
'user_id' : userId,
'_csrftoken' : self.token
})
return self.SendRequest('friendships/ignore/'+ str(userId) + '/', self.generateSignature(data))

def follow(self, userId):
data = json.dumps({'_uuid': self.uuid,
'_uid': self.username_id,
Expand Down
2 changes: 1 addition & 1 deletion InstagramAPI/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .InstagramAPI import *
from .InstagramAPI import *
from .ImageUtils import *

0 comments on commit 56693ad

Please sign in to comment.