vtemian / buffpy Goto Github PK
View Code? Open in Web Editor NEWSimple to use python library for Buffer App
License: MIT License
Simple to use python library for Buffer App
License: MIT License
I noticed that when I create a new update using these codes:
[Other code]
facebook_profile = Profiles(api=api).filter(_id="50a29021d932############")[0]
fb_media = None
if main_picture:
fb_media = {
"picture": main_picture,
"thumbnail": main_thumbnail
}
facebook_profile.updates.new(smart_str(fb_text), media=fb_media)
I Got this exception:
File "/Users/koalalorenzo/Documents/Dropbox/Progetti/Reali Network/reali-bufferizer/src/buffer-python/buffpy/managers/updates.py", line 110, in new
post_data += "profile_ids[]=%s&" % self.profile_id
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 59: ordinal not in range(128)
So I checked if the profile_id is not ASCII but it is. So I tried to use django smart_str to fix it but it does not work. My text is imported from XML using UTF-8 and converted to ASCII using this line:
descrizione = descrizione.decode(xml_obj.encoding).encode('ascii', 'xmlcharrefreplace')
What is my mistake? Is the profile_id not ascii? Is that ID the ID I gave( _id="50a29021d932############" ) ? The string is ASCII!
I am getting this error while trying one of the examples.
See #2
Hi,
Could we please get master published to pypi? Some breaking bugs such as #7 still exist in the pypi version.
We may also want to consider changing the version scheme as presently it complains with a PEP440 error.
Please let me know if I can help in any way.
Thanks!
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/13004714-publish-latest-to-pypi?utm_campaign=plugin&utm_content=tracker%2F301312&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F301312&utm_medium=issues&utm_source=github).Hi!
Nice module! Seems to work when you use access_token found in https://bufferapp.com/developers/apps, but it doesn't work when you use the code
returned after the user gives permission through https://bufferapp.com/oauth2/authorize?client_id=XXXXX
As far as I can see the following is not done:
POST https://api.bufferapp.com/1/oauth2/token.json
POST Data
client_id=...&
client_secret=...&
redirect_uri=...&
code=...&
grant_type=authorization_code
See https://bufferapp.com/developers/api/oauth for more info.
Thanks!
-- ddofborg
The managers, models, and tests directories don't seem to actually be included in the Python package https://pypi.python.org/pypi/buffpy/ , which means importing User, Profiles, etc. doesn't work.
I don't know much about Python packaging, but will take an initial poke around (or maybe just try manually installing from github for now)
thanks!
Pretty self-explanatory, nose
is not anymore defacto choice as the testing framework.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Hello,
I'm using buffpy to update my buffer and I've found problems when tryint to put this string:
u"Why Today’s Security Measures Just Don’t Cut It."
The problematic character seems to be the Unicode Character 'RIGHT SINGLE QUOTATION MARK' (U+2019) which appears twice in this string.
Looking at the code, it seems to be using unicode, but when passing the parameters to the oauth module (in api.py, line:
response = self.session.post(url=BASE_URL % url, headers=headers, **params)
text in params ('data', in particular) is unicode and the module (at least in my computer) seems to be expecting strings.
I've put before this line, the following one:
params['data'] = str(params['data']) response = self.session.post(url=BASE_URL % url, headers=headers, **params)
and everything seems to be working ok.
Maybe I'm completely wrong because I'm not very good at the particularities of unicode and string chars in Python, or the configuration of my system is not ok, but I wanted to check it here and give you a big thank you for the project.
Thanks.
Just updated and ran python examples/profiles.py
Well for video and a couple of other features I am trying to create a parallel post API which uses Content-Type": "application/json
instead of Content-Type": "application/x-www-form-urlencoded
but with little luck till now. Their web version uses Content-Type": "application/json
for all requests so it should be feasible.
To explain the case bit more, media[photo]=some_photo_url
is concatenated in photo case but for video case it needs a higher hierarchy ie media[video][details][location]=some_video_url
.I don't know how to encode that in application/x-www-form-urlencoded
(above multiple indexing as demonstrated doesn't work)
I will keep the action of this issue on myself, if anyone has idea feel free to discuss.
I will use the issue as my status book to keep anyone updated if interested and also to help me track my progress.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I stumbled across this while playing with a test script - errors are not exposed to the caller currently.
I posted the same update text twice and got a crash at the following:
File "/Users/alext/.virtualenvs/zumbido/lib/python2.7/site-packages/buffpy/managers/updates.py", line 132, in new
new_update = Update(api=self.api, raw_response=response['updates'][0])
KeyError: 'updates'
Poking around, the actual content returned was {u'message': u"Whoops, it looks like you've posted that one recently. Unfortunately, we're not able to post the same thing again so soon!", u'code': 1025, u'success': False}
I'll look into exposing the Buffer error messages (detailed here: https://bufferapp.com/developers/api/errors) and submit a PR in a few days or so. Unless someone is already looking at this, which is why we have this issue tracker :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.