pip install pygram
from pygram import PyGram
pygram = PyGram()
profile = pygram.get_profile('eminem')
from pygram import PyGram
pygram = PyGram()
user_id = pygram.get_user_id('eminem')
from pygram import PyGram
pygram = PyGram()
posts = pygram.get_posts('eminem', limit=10)
for post in posts:
print(post)
from pygram import PyGram
pygram = PyGram()
comments = pygram.get_comments(post, limit=10)
for comment in comments:
print(comment)
from pygram import PyGram
pygram = PyGram('user', 'password')
After the first login, a file with the name
pygram-cache.json
will be created in the current directory to avoid logging in again with every instantiation.
from pygram import PyGram
pygram = PyGram('user', 'password')
users = pygram.get_followers('eminem', limit=10)
for user in users:
print(user)
from pygram import PyGram
pygram = PyGram('user', 'password')
users = pygram.get_followed('drdre', limit=10)
for user in users:
print(user)
from pygram import PyGram
pygram = PyGram('user', 'password')
last_post = next(pygram.get_posts('eminem', limit=1))
pygram.like(last_post)
from pygram import PyGram
pygram = PyGram('user', 'password')
last_post = next(pygram.get_posts('eminem', limit=1))
pygram.unlike(last_post)
from pygram import PyGram
pygram = PyGram('user', 'password')
pygram.comment(post, 'this is the comment')
from pygram import PyGram
pygram = PyGram('user', 'password')
pygram.delete(comment)