Exemple #1
0
 def post(self, mid):
     api = InstagramAPI(access_token=request.access_token)
     form = MediaCommentForm()
     if not form.validate():
         media_info = self._get_media(api, mid)
         return render('media.html', form=form, **media_info)
     api.create_media_comment(media_id=mid, text=form.content.data)
     media_info = self._get_media(api, mid)
     return render('media.html', form=form, **media_info)
Exemple #2
0
 def get(self):
     action = request.args.get('action', 'create_comment')
     mid = request.args.get('mid', '')
     text = request.args.get('text', '')
     api = InstagramAPI(access_token=session.get('access_token', ''))
     if action == 'create_comment':
         api.create_media_comment(media_id=mid, text=text)
     elif action == 'delete_comment':
         cid = request.args.get('comment_id', '')
         api.delete_comment(media_id=mid, comment_id=cid)
     return json_response('ok')