File: person.rst

package info (click to toggle)
python-pypump 0.3%2Bgit20130823.1.97bffc6-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 328 kB
  • ctags: 333
  • sloc: python: 1,630; makefile: 140; sh: 7
file content (120 lines) | stat: -rw-r--r-- 3,047 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

Person
=======

This object represents a user on pump.io. 

.. note:: The pump variable is an instantiated PyPump class e.g. pump = PyPump("<webfinger>", client_name="<name>", etc...)

.. py:class:: Person

    This represents a Person object, These are used in getting their inboxes, information on, etc...
    

    .. py:attribute:: preferred_username

        This is the username (you should display the display_name) (unicode)::

	        >>> a_person.preferred_username
            u'Tsyesika' 

    .. py:attribute:: display_name

        This is the username you should display (unicode)::

            >>> a_person.display_name
            u'Tsyesìka'

    .. py:attribute:: updated

        This is when their profile was updated (datetime.datetime)::

            >>> a_person.updated
	        datetime.datetime(2013, 6, 15, 12, 31, 22, 134180)

    .. py:attribute:: published

        This is when their profile was first published (datetime.datetime)::

	        >>> a_person.published
            datetime.datetime(2013, 6, 15, 12, 31, 22, 134180)

    .. py:attribute:: url

        The URL to the profile (string)::

	        >>> a_person.url
            'https://pump.megworld.co.uk/Tsyesika'

    .. py:attribute:: followers

        This is a list of their followers (list)::

            >>> a_person.followers
            [<Person: person1@yep.org>, <Person: person2@pumpit.com>, <Person: someoneelse@example.com>

    .. py:attribute:: following

        This is a list of all the people they're following::

            >>> a_person.following
            [<Person: TheBestPersonEvah@pump.megworld.co.uk>]

    .. py:attribute:: location

        This is the location of the user (Location object)::

             >>> a_person.location
             <Location: Manchester, UK>

    .. py:attribute:: summary

        This is the summer of the user (unicode)::

             >>> a_person.summary
             u'The maker of this fabulous library!'

    .. py:attribute:: image

        This is the image of the person (Image object)::

            >>> a_person.image
            <Image: https://pump.megworld.co.uk/uploads/Tsyesika/2013/6/15/blahblah.png>

    .. py:method:: follow

        This will follow the user if you're not already following them

    .. py:method:: unfollow

        This will stop following the user if you were following them

        

Example
-------

This shows how to follow someone::

    >>> a_person.follow() # yay we're now following them!

What happens when i try and follow someone I am?::

    >>> a_person.follow() # nothing? yep.
    
Well, I don't want to follow them::

    >>> a_person.unfollow() # awhh :(

You want to find yourfriend@pumpity.net::

    >>> my_friend = pump.Person("yourfriend@pumpity.net")
    Traceback (most recent call last):
        blah blah
        you know the drill
    DoesNotExist: Can't find yourfriend@pumpity.net

Oh that's right they're on pump.megworld.co.uk::

    >>> my_friend = pump.Person("myfriend@pump.megworld.co.uk")
    >>> # Awesome!