Expected str, bytes or os.PathLike object, not BoundField in instaapi

I was trying to post a picture in instagram, I have picture url, caption, instagram username and password in 3 different model, I'm sending primary key of the models in response.

class InstagramPost(APIView): @staticmethod def post(request, user_id, pk, attachment_id, *args, **kwargs): user_name = get_user_name(user_id) caption = get_post(pk) url = get_attachment(attachment_id) bot = Bot() bot.login(username=user_name['name'], password=user_name['password'], is_threaded=True) print(user_name['name']) print(user_name['password']) bot.upload_photo(url[r'url'], caption=caption['caption']) print(url['url']) print(caption['caption']) return HttpResponse("posted")

Back to Top