Python wrapper for the Buffer API
Project description
==========================================
|img| puffer |qs| |bs| |cc| |rtd| |gitter|
==========================================
Simple to use python wrapper for the Buffer API
.. |img| image:: https://raw.githubusercontent.com/villasv/puffer/master/docs/icon_sm.png
:width: 30
.. |qs| image:: https://scrutinizer-ci.com/g/villasv/puffer/badges/quality-score.png?b=master
:target: https://scrutinizer-ci.com/g/villasv/puffer/?branch=master
.. |bs| image:: https://travis-ci.org/villasv/puffer.svg?branch=master
:target: https://travis-ci.org/villasv/puffer
.. |cc| image:: https://coveralls.io/repos/github/villasv/puffer/badge.svg?branch=master
:target: https://coveralls.io/github/villasv/puffer?branch=master
.. |rtd| image:: https://readthedocs.org/projects/puffer/badge/?version=latest
:target: http://puffer.readthedocs.io/en/latest/?badge=latest
.. |gitter| image:: https://badges.gitter.im/villasv/puffer.svg
:target: https://gitter.im/villasv/puffer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
### ORM`ish
------------
Bufferapp.com details some useful entities:
* user
* profile
* update
* link
* info
Every entity can be seen as an object that has attributes and methods. Those
methdos and attributes are linked to certain endpoints.
All objects are special dicts. For example, you can do something like:
```python
user.id => '12455678976asd'
user => {...}
```
If you want to see more complete examples, click [here](../master/examples)
#### Authorization
------------------
Get access_token using buffer [docs](https://bufferapp.com/developers/api/oauth)
```python
service = AuthService(client_id, client_secret, redirect_uri)
url = service.authorize_url
# Access the url and retrieve the token
auth_code = #Paste the code from the redirected url
access_token = service.get_access_token(auth_code)
api = service.create_session(access_token)
```
#### User
----------
A user represents a single Buffer user account.
```python
api = API(client_id='client_id',
client_secret='client_secret',
access_token='access_token')
# instantiate an user object
user = User(api=api)
print user
print user.id
print user.timezone
```
#### Profile
------------
A Buffer profile represents a connection to a single social media account.
```python
profiles = Profiles(api=api)
print profiles.all() # get all profiles
# filter profiles using some criteria
profile = Profiles(api=api).filter(service='twitter')[0]
print profile # my twitter profile
# get schedules of my twitter profile
print profile.schedules
# update schedules times for my twitter profile
profile.schedules = {
'days': ['tue', 'thu'],
'times': ['13:45']
}
```
#### Update
-----------
An update represents a single post to a single social media account.
```python
# retrieve a single update based on an id
update = Update(api=api, id='51de8d33e48c051712000019')
print update
# get update's interactions
print update.interactions
# edit
update = update.edit(text="Hey!")
# publish now
update.publish()
# move to top
update.move_to_top()
# delete
update.delete()
```
#### Updates and profiles
-------------------------
```python
# get all pending updates of a social network profile
profile = Profiles(api=api).filter(service='twitter')[0]
print profile.updates.pending
# get all sent updates of a social network profile
print profile.updates.sent
# retrieve all update's interactions
print profile.updates.sent[0].interactions
# shuffle updates
print profile.updates.shuffle(count=10)
# reorder updates
print profile.updates.reorder(['51dd27629f7fdf520d00009a'])
# create an update
print profile.updates.new("Hello there", now=True)
```
#### Links
----------
A link represents a unique URL that has been shared through Buffer
```python
# get a link's shares
print Link(api=api, url='http%3A%2F%2Fbufferapp.com').shares
```
#### Info
---------
Returns an object with the current configuration that Buffer is using,
including supported services, their icons and the varying limits of character
and schedules.
```python
# instantiate the api object
api = API(client_id='client_id',
client_secret='client_secret',
access_token='access_token')
# get api's info
print api.info
```
|img| puffer |qs| |bs| |cc| |rtd| |gitter|
==========================================
Simple to use python wrapper for the Buffer API
.. |img| image:: https://raw.githubusercontent.com/villasv/puffer/master/docs/icon_sm.png
:width: 30
.. |qs| image:: https://scrutinizer-ci.com/g/villasv/puffer/badges/quality-score.png?b=master
:target: https://scrutinizer-ci.com/g/villasv/puffer/?branch=master
.. |bs| image:: https://travis-ci.org/villasv/puffer.svg?branch=master
:target: https://travis-ci.org/villasv/puffer
.. |cc| image:: https://coveralls.io/repos/github/villasv/puffer/badge.svg?branch=master
:target: https://coveralls.io/github/villasv/puffer?branch=master
.. |rtd| image:: https://readthedocs.org/projects/puffer/badge/?version=latest
:target: http://puffer.readthedocs.io/en/latest/?badge=latest
.. |gitter| image:: https://badges.gitter.im/villasv/puffer.svg
:target: https://gitter.im/villasv/puffer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
### ORM`ish
------------
Bufferapp.com details some useful entities:
* user
* profile
* update
* link
* info
Every entity can be seen as an object that has attributes and methods. Those
methdos and attributes are linked to certain endpoints.
All objects are special dicts. For example, you can do something like:
```python
user.id => '12455678976asd'
user => {...}
```
If you want to see more complete examples, click [here](../master/examples)
#### Authorization
------------------
Get access_token using buffer [docs](https://bufferapp.com/developers/api/oauth)
```python
service = AuthService(client_id, client_secret, redirect_uri)
url = service.authorize_url
# Access the url and retrieve the token
auth_code = #Paste the code from the redirected url
access_token = service.get_access_token(auth_code)
api = service.create_session(access_token)
```
#### User
----------
A user represents a single Buffer user account.
```python
api = API(client_id='client_id',
client_secret='client_secret',
access_token='access_token')
# instantiate an user object
user = User(api=api)
print user
print user.id
print user.timezone
```
#### Profile
------------
A Buffer profile represents a connection to a single social media account.
```python
profiles = Profiles(api=api)
print profiles.all() # get all profiles
# filter profiles using some criteria
profile = Profiles(api=api).filter(service='twitter')[0]
print profile # my twitter profile
# get schedules of my twitter profile
print profile.schedules
# update schedules times for my twitter profile
profile.schedules = {
'days': ['tue', 'thu'],
'times': ['13:45']
}
```
#### Update
-----------
An update represents a single post to a single social media account.
```python
# retrieve a single update based on an id
update = Update(api=api, id='51de8d33e48c051712000019')
print update
# get update's interactions
print update.interactions
# edit
update = update.edit(text="Hey!")
# publish now
update.publish()
# move to top
update.move_to_top()
# delete
update.delete()
```
#### Updates and profiles
-------------------------
```python
# get all pending updates of a social network profile
profile = Profiles(api=api).filter(service='twitter')[0]
print profile.updates.pending
# get all sent updates of a social network profile
print profile.updates.sent
# retrieve all update's interactions
print profile.updates.sent[0].interactions
# shuffle updates
print profile.updates.shuffle(count=10)
# reorder updates
print profile.updates.reorder(['51dd27629f7fdf520d00009a'])
# create an update
print profile.updates.new("Hello there", now=True)
```
#### Links
----------
A link represents a unique URL that has been shared through Buffer
```python
# get a link's shares
print Link(api=api, url='http%3A%2F%2Fbufferapp.com').shares
```
#### Info
---------
Returns an object with the current configuration that Buffer is using,
including supported services, their icons and the varying limits of character
and schedules.
```python
# instantiate the api object
api = API(client_id='client_id',
client_secret='client_secret',
access_token='access_token')
# get api's info
print api.info
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
puffer-1.8.2.zip
(19.8 kB
view details)
Built Distribution
puffer-1.8.2-py3-none-any.whl
(18.1 kB
view details)
File details
Details for the file puffer-1.8.2.zip
.
File metadata
- Download URL: puffer-1.8.2.zip
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67fc425f28c14fa09a7867444482e461d455d0d79028ac9bee7d35aa4a602f6a |
|
MD5 | 32ac30842ff624eed61c572c215f4fb6 |
|
BLAKE2b-256 | c5edbd63ad7617ebd986e1a469e2dec3855573d720e7a18f8a7e247451ce92e1 |
File details
Details for the file puffer-1.8.2-py3-none-any.whl
.
File metadata
- Download URL: puffer-1.8.2-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48278b96302f648c6032a2c561294c8de2fc2a941212f1868b096c0b65565b68 |
|
MD5 | c90940519ce14f9e34fc7eeb2f71c145 |
|
BLAKE2b-256 | 5881e710d293557f2f3144efe74d500ecf117e745d4f67699071d588ba2e4fb6 |