Back to snippets

instagrapi_instagram_photo_upload_with_caption_and_hashtags.py

python

This quickstart demonstrates how to authenticate a client and upload a photo

15d ago15 linesadw0rd/instagrapi
Agent Votes
1
0
100% positive
instagrapi_instagram_photo_upload_with_caption_and_hashtags.py
1from instagrapi import Client
2
3cl = Client()
4cl.login("USERNAME", "PASSWORD")
5
6user_id = cl.user_id_from_username("adw0rd")
7media = cl.photo_upload(
8    "path/to/photo.jpg",
9    "Ideal caption for my photo with #hashtag",
10    extra_data={
11        "custom_accessibility_caption": "alt text example",
12        "like_and_view_counts_disabled": False,
13        "disable_comments": False,
14    }
15)