Classes doing most of the work.
Main class to interface with PyPump.
This class keeps everything together and is responsible for making requests to the server on it’s own behalf and on the behalf of the other clients as well as handling the OAuth requests.
Parameters: |
|
---|
This represents a client/application which is using the Pump API.
Parameters: |
|
---|
Additionally, the following init args should only be supplied if you’ve already registered this client with the server. If not, these will be filled in during the self.register() step.
Parameters: |
|
---|
Note that the above three are not the same as the oauth permissions verifying the user has access to post, this is related to permissions and identification of the client software to post. For the premission related to the access of the account, see PyPump.key and PyPump.secret.
This object represents a pump.io note, notes are used to post text (or html) messages to the pump.io network.
Parameters: |
|
---|
Usage:
>>> mynote = pump.Note(content='<b>Hello</b> world!')
>>> mynote.send()
List of secondary recipients. The object will show up in the recipients inbox when sent.
>>> mynote = pump.Note('hello world')
>>> mynote.cc = pump.Public
Add a Comment to the object.
Parameters: | comment – A Comment instance, text content is also accepted. |
---|
>>> anote.comment(pump.Comment('I agree!'))
A Feed of the comments for the object.
>>> for comment in mynote.comments:
... print(comment)
...
comment by pypumptest2@pumpyourself.com
Delete the object content on the server.
>>> mynote.deleted
>>> mynote.delete()
>>> mynote.deleted
datetime.datetime(2014, 10, 19, 9, 26, 39, tzinfo=tzutc())
Favorite the object.
A Feed of the people who’ve liked the object.
>>> for person in mynote.likes:
... print(person.webfinger)
...
pypumptest1@pumpity.net
pypumptest2@pumpyourself.com
Like the object.
>>> anote.liked
False
>>> anote.like()
>>> anote.liked
True
A Feed of the people who’ve liked the object.
>>> for person in mynote.likes:
... print(person.webfinger)
...
pypumptest1@pumpity.net
pypumptest2@pumpyourself.com
Send the object to the server.
>>> mynote = pump.Note('Hello world!)
>>> mynote.send()
Share the object.
>>> anote.share()
A Feed of the people who’ve shared the object.
>>> for person in mynote.shares:
... print(person.webfinger)
...
pypumptest1@pumpity.net
pypumptest2@pumpyourself.com
List of primary recipients. If entry is a Person the object will show up in their direct inbox when sent.
>>> mynote = pump.Note('hello pypumptest1')
>>> mynote.to = pump.Person('pypumptest1@pumpity.net')
>>> mynote.to
[<Person: pypumptest1@pumpity.net>]
Unfavorite a previously favorited object.
Unlike a previously liked object.
>>> anote.liked
True
>>> anote.unlike()
>>> anote.liked
False
Unshare a previously shared object.
>>> anote.unshare()
This object represents a pump.io image, images are used to post image content with optional text (or html) messages to the pump.io network.
Parameters: |
|
---|
>>> myimage = pump.Image(display_name='Happy Caturday!')
>>> myimage.from_file('/path/to/kitteh.png')
ImageContainer holding information about the thumbnail image.
ImageContainer holding information about the original image.
List of secondary recipients. The object will show up in the recipients inbox when sent.
>>> mynote = pump.Note('hello world')
>>> mynote.cc = pump.Public
Add a Comment to the object.
Parameters: | comment – A Comment instance, text content is also accepted. |
---|
>>> anote.comment(pump.Comment('I agree!'))
A Feed of the comments for the object.
>>> for comment in mynote.comments:
... print(comment)
...
comment by pypumptest2@pumpyourself.com
Delete the object content on the server.
>>> mynote.deleted
>>> mynote.delete()
>>> mynote.deleted
datetime.datetime(2014, 10, 19, 9, 26, 39, tzinfo=tzutc())
Favorite the object.
A Feed of the people who’ve liked the object.
>>> for person in mynote.likes:
... print(person.webfinger)
...
pypumptest1@pumpity.net
pypumptest2@pumpyourself.com
Uploads an image from a filename on your system.
Parameters: | filename – Path to file on your system. |
---|
>>> myimage.from_file('/path/to/dinner.png')
Like the object.
>>> anote.liked
False
>>> anote.like()
>>> anote.liked
True
A Feed of the people who’ve liked the object.
>>> for person in mynote.likes:
... print(person.webfinger)
...
pypumptest1@pumpity.net
pypumptest2@pumpyourself.com
Share the object.
>>> anote.share()
A Feed of the people who’ve shared the object.
>>> for person in mynote.shares:
... print(person.webfinger)
...
pypumptest1@pumpity.net
pypumptest2@pumpyourself.com
List of primary recipients. If entry is a Person the object will show up in their direct inbox when sent.
>>> mynote = pump.Note('hello pypumptest1')
>>> mynote.to = pump.Person('pypumptest1@pumpity.net')
>>> mynote.to
[<Person: pypumptest1@pumpity.net>]
Unfavorite a previously favorited object.
Unlike a previously liked object.
>>> anote.liked
True
>>> anote.unlike()
>>> anote.liked
False
Unshare a previously shared object.
>>> anote.unshare()
This object represents a pump.io comment, comments are used to post text (or html) messages in reply to other objects on the pump.io network.
Parameters: |
|
---|
>>> catpic
<Image by alice@example.org>
>>> mycomment = pump.Comment(content='Best cat pic ever!', in_reply_to=catpic)
>>> mycomment.send()
List of secondary recipients. The object will show up in the recipients inbox when sent.
>>> mynote = pump.Note('hello world')
>>> mynote.cc = pump.Public
Add a Comment to the object.
Parameters: | comment – A Comment instance, text content is also accepted. |
---|
>>> anote.comment(pump.Comment('I agree!'))
A Feed of the comments for the object.
>>> for comment in mynote.comments:
... print(comment)
...
comment by pypumptest2@pumpyourself.com
Delete the object content on the server.
>>> mynote.deleted
>>> mynote.delete()
>>> mynote.deleted
datetime.datetime(2014, 10, 19, 9, 26, 39, tzinfo=tzutc())
Favorite the object.
A Feed of the people who’ve liked the object.
>>> for person in mynote.likes:
... print(person.webfinger)
...
pypumptest1@pumpity.net
pypumptest2@pumpyourself.com
Like the object.
>>> anote.liked
False
>>> anote.like()
>>> anote.liked
True
A Feed of the people who’ve liked the object.
>>> for person in mynote.likes:
... print(person.webfinger)
...
pypumptest1@pumpity.net
pypumptest2@pumpyourself.com
Send the object to the server.
>>> mynote = pump.Note('Hello world!)
>>> mynote.send()
Share the object.
>>> anote.share()
A Feed of the people who’ve shared the object.
>>> for person in mynote.shares:
... print(person.webfinger)
...
pypumptest1@pumpity.net
pypumptest2@pumpyourself.com
List of primary recipients. If entry is a Person the object will show up in their direct inbox when sent.
>>> mynote = pump.Note('hello pypumptest1')
>>> mynote.to = pump.Person('pypumptest1@pumpity.net')
>>> mynote.to
[<Person: pypumptest1@pumpity.net>]
Unfavorite a previously favorited object.
Unlike a previously liked object.
>>> anote.liked
True
>>> anote.unlike()
>>> anote.liked
False
Unshare a previously shared object.
>>> anote.unshare()
This object represents a pump.io person, a person is a user on the pump.io network.
Parameters: | webfinger – User ID in nickname@hostname format. |
---|
>>> alice = pump.Person('alice@example.org')
>>> print(alice.summary)
Hi, I'm Alice
>>> mynote = pump.Note('Hey Alice, it's Bob!')
>>> mynote.to = alice
>>> mynote.send()
List of secondary recipients. The object will show up in the recipients inbox when sent.
>>> mynote = pump.Note('hello world')
>>> mynote.cc = pump.Public
Feed with all objects liked/favorited by the person.
>>> for like in pump.me.favorites[:3]:
... print(like)
...
note by alice@example.org
image by bob@example.org
comment by evan@e14n.com
Feed with all Person objects following the person.
>>> alice = pump.Person('alice@example.org')
>>> for follower in alice.followers[:2]:
... print(follower.id)
...
acct:bob@example.org
acct:carol@example.org
Feed with all Person objects followed by the person.
>>> bob = pump.Person('bob@example.org')
>>> for followee in bob.following[:3]:
... print(followee.id)
...
acct:alice@example.org
acct:duncan@example.org
Inbox feed with all activities received by the person, can only be read if logged in as the owner.
>>> for activity in pump.me.inbox[:2]:
... print(activity.id)
...
https://microca.st/api/activity/BvqXQOwXShSey1HxYuJQBQ
https://pumpyourself.com/api/activity/iQGdnz5-T-auXnbUUdXh-A
Lists feed with all lists owned by the person.
>>> for list in pump.me.lists:
... print(list)
...
Acquaintances
Family
Coworkers
Friends
Outbox feed with all activities sent by the person.
>>> for activity in pump.me.outbox[:2]:
... print(activity)
...
pypumptest2 unliked a comment in reply to a note
pypumptest2 deleted a note
List of primary recipients. If entry is a Person the object will show up in their direct inbox when sent.
>>> mynote = pump.Note('hello pypumptest1')
>>> mynote.to = pump.Person('pypumptest1@pumpity.net')
>>> mynote.to
[<Person: pypumptest1@pumpity.net>]
This object represents a pump.io inbox feed, it contains all activities posted to the owner of the inbox.
>>> for activity in pump.me.inbox.items(limit=3):
... print(activity)
Alice posted a note
Bob posted a comment in reply to a note
Alice liked a comment
Direct inbox feed, contains activities addressed directly to the owner of the inbox.
Get a feed’s items.
Parameters: |
|
---|
This object represents a pump.io outbox feed, it contains all activities posted by the owner of the outbox.
>>> for activity in pump.me.outbox.items(limit=3):
... print(activity)
Bob posted a note
Bob liked an image
Bob followed Alice
Get a feed’s items.
Parameters: |
|
---|
This object represents a pump.io lists feed, it contains the collections (or lists) created by the owner.
>>> for i in pump.me.lists.items():
... print(i)
Coworkers
Acquaintances
Family
Friends
Create a new user list collection.
Parameters: |
|
---|
>>> pump.me.lists.create(display_name='Friends', content='List of friends')
>>> myfriends = pump.me.lists['Friends']
>>> print(myfriends)
Friends
Get a feed’s items.
Parameters: |
|
---|
Classes you probably don’t need to know about.
Container that holds information about an image.
Parameters: |
|
---|
This object represents a basic pump.io feed, which is used for navigating a list of objects (inbox,followers,shares,likes and so on).
Get a feed’s items.
Parameters: |
|
---|
This object represents a pump.io collection, collections have a members Feed and methods for adding and removing objects to that feed.
Parameters: | id – (optional) Collection id. |
---|
>>> friendlist = pump.me.lists['Friends']
>>> list(friendlist.members)
[<Person: alice@example.org>]
>>> friendlist.add(pump.Person('bob@example.org'))
Adds a member to the collection.
Parameters: | obj – Object to add. |
---|
>>> mycollection.add(pump.Person('bob@example.org'))
Delete the object content on the server.
>>> mynote.deleted
>>> mynote.delete()
>>> mynote.deleted
datetime.datetime(2014, 10, 19, 9, 26, 39, tzinfo=tzutc())