New `diaspy.people.User()` object (plus manual)
[diaspy.git] / manual / people.mdown
1 #### `User()` object
2
3 This object is used to represent a D\* user.
4
5 ----
6
7 ##### Getting user data
8
9 You have to know either GUID or *diaspora_id* of a user.
10 Assume that *12345678abcdefgh* and *otheruser@pod.example.com* point to
11 the same user.
12
13
14 >>> c = diaspy.connection.Connection('https://pod.example.com', 'foo', 'bar')
15 >>>
16 >>> user_guid = diaspy.people.User(c)
17 >>> user_guid.fetchguid('12345678abcdefgh')
18 >>>
19 >>> user_handle = diaspy.people.User(c)
20 >>> user_handle.fetchhandle('otheruser@pod.example.com')
21
22 Now, you have two `User()` objects containing the data of one user.
23
24 The object is subscriptable so you can do like this:
25
26 >>> user_guid['diaspora_id']
27 'otheruser@pod.example.com'
28 >>>
29 >>> user_handle['guid']
30 '12345678abcdefgh'
31
32
33 User object contains following items:
34
35 * `id`, `str`, id of the user;
36 * `guid`, `str`, guid of the user;
37 * `diaspora_id`, `str`, D\* id of the user;
38 * `name`, `str`, name of the user;
39 * `avatar`, `dict`, links to avatar of the user;
40 * `stream`, `diaspy.streams.Outer`, stream of the user (provides all methods of generic stream);
41
42
43 ----
44
45 ###### Manual for `diaspy`, written by Marek Marecki