コード例 #1
0
 def test_upload_video_story(self):
     media_pk = self.api.media_pk_from_url(
         "https://www.instagram.com/p/Bk2tOgogq9V/")
     path = self.api.video_download(media_pk)
     self.assertIsInstance(path, Path)
     caption = 'Test video caption'
     adw0rd = self.api.user_info_by_username('adw0rd')
     self.assertIsInstance(adw0rd, User)
     mentions = [StoryMention(user=adw0rd)]
     links = [StoryLink(webUri='https://adw0rd.com/')]
     hashtags = [StoryHashtag(hashtag=self.api.hashtag_info('dhbastards'))]
     locations = [
         StoryLocation(location=Location(
             pk=150300262230285,
             name='Blaues Wunder (Dresden)',
         ))
     ]
     try:
         buildout = StoryBuilder(path, caption, mentions,
                                 Path('./examples/background.png')).video(1)
         story = self.api.video_upload_to_story(
             buildout.path,
             caption,
             mentions=buildout.mentions,
             links=links,
             hashtags=hashtags,
             locations=locations,
         )
         self.assertIsInstance(story, Story)
         self.assertTrue(story)
     finally:
         cleanup(path)
         self.assertTrue(self.api.story_delete(story.id))
コード例 #2
0
 def test_upload_photo_story(self):
     media_pk = self.api.media_pk_from_url(
         "https://www.instagram.com/p/B3mr1-OlWMG/")
     path = self.api.photo_download(media_pk)
     self.assertIsInstance(path, Path)
     caption = 'Test photo caption'
     adw0rd = self.api.user_info_by_username('adw0rd')
     self.assertIsInstance(adw0rd, User)
     mentions = [StoryMention(user=adw0rd)]
     links = [StoryLink(webUri='https://adw0rd.com/')]
     hashtags = [StoryHashtag(hashtag=self.api.hashtag_info('dhbastards'))]
     locations = [
         StoryLocation(location=Location(
             pk=150300262230285,
             name='Blaues Wunder (Dresden)',
         ))
     ]
     try:
         story = self.api.photo_upload_to_story(
             path,
             caption,
             mentions=mentions,
             links=links,
             hashtags=hashtags,
             locations=locations,
         )
         self.assertIsInstance(story, Story)
         self.assertTrue(story)
     finally:
         cleanup(path)
         self.assertTrue(self.api.story_delete(story.id))
コード例 #3
0
 def test_upload_photo_story(self):
     media_pk = self.api.media_pk_from_url(
         "https://www.instagram.com/p/B3mr1-OlWMG/")
     path = self.api.photo_download(media_pk)
     self.assertIsInstance(path, Path)
     caption = 'Test photo caption'
     adw0rd = self.api.user_info_by_username('adw0rd')
     self.assertIsInstance(adw0rd, User)
     mentions = [StoryMention(user=adw0rd)]
     links = [StoryLink(webUri='https://adw0rd.com/')]
     try:
         story = self.api.photo_upload_to_story(path,
                                                caption,
                                                mentions=mentions,
                                                links=links)
         self.assertIsInstance(story, Story)
         self.assertTrue(story)
     finally:
         cleanup(path)
         self.assertTrue(self.api.story_delete(story.id))
コード例 #4
0
 def test_upload_video_story(self):
     media_pk = self.api.media_pk_from_url(
         "https://www.instagram.com/p/Bk2tOgogq9V/")
     path = self.api.video_download(media_pk)
     self.assertIsInstance(path, Path)
     caption = 'Test video caption'
     adw0rd = self.api.user_info_by_username('adw0rd')
     self.assertIsInstance(adw0rd, User)
     mentions = [StoryMention(user=adw0rd)]
     links = [StoryLink(webUri='https://adw0rd.com/')]
     try:
         buildout = StoryBuilder(path, caption, mentions,
                                 Path('./examples/background.png')).video(1)
         story = self.api.video_upload_to_story(buildout.path,
                                                caption,
                                                mentions=buildout.mentions,
                                                links=links)
         self.assertIsInstance(story, Story)
         self.assertTrue(story)
     finally:
         cleanup(path)
         self.assertTrue(self.api.story_delete(story.id))