Skip to content

Commit

Permalink
Create Example Delete Media
Browse files Browse the repository at this point in the history
  • Loading branch information
r17x committed Mar 26, 2018
1 parent 6dc328f commit 589db0d
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions examples/delete_media.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Use text editor to edit the script and type in valid Instagram username/password
#
# example delete_media
# this example for how to delete self media feed
# have 2 parameter on method deleteMedia( MediaID, MediaType)

from InstagramAPI import InstagramAPI

username = '' #change this
password = '' #change this

ig = InstagramAPI(username, password)

ig.login()

# get Self user feed
ig.getSelfUserFeed()

# get response json and assignment value to MediaList Variable
# dict type data
MediaList = ig.LastJson

# get first media for example delete media
Media = MediaList['items'][0]

# get media ID

MediaID = Media['pk']
MediaType = Media['media_type']

# call deleteMedia Method
# deleteMedia return BOOL {true|false}
isDeleted = ig.deleteMedia(MediaID, media_type=MediaType)

if isDeleted:
print("Your Media {0} has been deleted".format(
MediaID
))
else:
print("Your Media Not Deleted")

0 comments on commit 589db0d

Please sign in to comment.