File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """ Script to demostrate the use of ciscosparkapi for the people API
4
+
5
+ The package natively retrieves your Spark access token from the
6
+ SPARK_ACCESS_TOKEN environment variable. You must have this environment
7
+ variable set to run this script.
8
+
9
+ """
10
+
11
+
12
+ from __future__ import print_function
13
+ from ciscosparkapi import CiscoSparkAPI
14
+
15
+
16
+ try :
17
+ api = CiscoSparkAPI () # Create a CiscoSparkAPI connection object; uses your SPARK_ACCESS_TOKEN
18
+ except Exception as e :
19
+ print (e )
20
+
21
+
22
+ # Get my user information
23
+ print ("Get my information ..." )
24
+ me = api .people .me ()
25
+ print (me )
26
+
27
+ # Get my user information using id
28
+ print ("Get my information but using id ..." )
29
+ me_by_id = api .people .get (me .id )
30
+ print (me_by_id )
31
+
32
+ # Get my user information using id
33
+ print ("Get the list of people I know ..." )
34
+ people = api .people .list (displayName = "Jose" ) # Creates a generator container (iterable) that lists the people I know
35
+ for person in people :
36
+ print (person .displayName ) # Return the displayName of every person found
You can’t perform that action at this time.
0 commit comments