vtemian / buffpy

Simple to use python library for Buffer App
MIT License
23 stars 29 forks source link

AttributeError: 'Profile' object has no attribute 'id' #17

Closed ishandutta2007 closed 5 years ago

ishandutta2007 commented 5 years ago

Just updated and ran python examples/profiles.py

ishandutta2007 commented 5 years ago

Traceback (most recent call last): File "examples/profiles.py", line 24, in pp(profile.schedules) File "/Users/ishandutta2007/.pyenv/versions/3.6.0/lib/python3.6/site-packages/buffpy/models/profile.py", line 32, in schedules url = PATHS["GET_SCHEDULES"].format(self.id) AttributeError: 'Profile' object has no attribute 'id'

fernand0 commented 5 years ago

Hello,

I've solved it substituting self.id by self['id'] but I'm not sure if it is the correct way.

ishandutta2007 commented 5 years ago

@fernand0 Yes exactly. For all examples I had to do that.Not sure why no one has updated it

ishandutta2007 commented 5 years ago

@fernand0 Hey buddy , just incase you are using buffer to create new posts to instagram via Buffer, I have a small question. In the Buffer API I couldn't find an option to set Location which the website provides. Do you know if there's any option via API ?

fernand0 commented 5 years ago

Hello @ishandutta2007, I tried it but I was not able to use it (not sure about how to include the image). I found another module (https://github.com/LevPasha/Instagram-API-python ) and I'm using it in my own module: https://github.com/fernand0/scripts/blob/master/moduleInstagram.py

ishandutta2007 commented 5 years ago

Including image is straight forward. just put a link to 'photo' here.. it should be a cdn link. https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/tests/test_updates_manager.py#L132

I am looking for options like setting location or tagging a user

ishandutta2007 commented 5 years ago

In InstagramAPI you don't use Buffer or alike to schedule ?

ishandutta2007 commented 5 years ago

I checked your script, basically you are running your own scheduler. right? you can check https://github.com/socialbotspy/BufferPy , we have got scheduling working via buffer using the current library. We are just waiting on the Location field to make experience more complete. For other APIs I use https://github.com/instagrambot.

fernand0 commented 5 years ago

Including image is straight forward. just put a link to 'photo' here.. it should be a cdn link.

https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/tests/test_updates_manager.py#L132

I am looking for options like setting location or tagging a user

Yes, it is but I wanted to upload the image directly, not to put it somewhere in order to upload it to Instagram.

fernand0 commented 5 years ago

I checked your script, basically you are running your own scheduler. right? you can check https://github.com/socialbotspy/BufferPy , we have got scheduling working via buffer using the current library. We are just waiting on the Location field to make experience more complete. For other APIs I use https://github.com/instagrambot.

Yes I'm using cron to schedule posts. I'll check your links, thanks!

vtemian commented 5 years ago

@fernand0 @ishandutta2007 sorry for the late reply. This issue should be fixed, I just didn't release the package on pypi.

ishandutta2007 commented 5 years ago

@vtemian I made the necessary change, I am using your API but buffer don't seem to have location for instagram posts in their API which they have in their web version. Do you know of any work around ? Their Web-UI posts two additional field for Location ie "geolocation_id" and "geolocation_name". I tried adding to your updates API's new()here but of no help, it silently ignore extra extra fields. Maybe the Web is using some other API

ishandutta2007 commented 5 years ago

@vtemian we were discussing scripts from examples folder, nothing to do with publishing to pypi.

vtemian commented 5 years ago

@ishandutta2007 sadly I don't know any fix for your problem. Regarding the publishing, I was referring that the scripts from examples are working with the current version from master. If you installed the package via git, directly from master, they should work. Otherwise, if you installed it via pypi, then you need to make the changes you mentioned.

ishandutta2007 commented 5 years ago

If you installed the package via git, directly from master, they should work.

Well for most people it doesn't, to make it work I had to change all profile.id to profile['id'], profile.updates to profile['updates'] and so on for other objects as well.

Most others have done the same https://github.com/vtemian/buffpy/issues/17#issuecomment-522498440 But let's leave that, that's too smaller topic to waste time upon, which is why I have closed the ticket immediately after @fernand0 's reply.

ishandutta2007 commented 5 years ago

sadly I don't know any fix for your problem.

My bad, there was a bug in my code. Now it's working . Fixed it here https://github.com/vtemian/buffpy/issues/21 Please review the PR