Package pushnotify
[hide private]
[frames] | no frames]

Source Code for Package pushnotify

 1  #!/usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3  # 
 4  # Copyright (C) 2013 Jeffrey Goettsch and other contributors. 
 5  # 
 6  # This file is part of py-pushnotify. 
 7  # 
 8  # py-pushnotify is free software: you can redistribute it and/or modify 
 9  # it under the terms of the GNU General Public License as published by 
10  # the Free Software Foundation, either version 3 of the License, or 
11  # (at your option) any later version. 
12  # 
13  # py-pushnotify is distributed in the hope that it will be useful, 
14  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16  # GNU General Public License for more details. 
17  # 
18  # You should have received a copy of the GNU General Public License 
19  # along with py-pushnotify.  If not, see <http://www.gnu.org/licenses/>. 
20   
21  import logging 
22   
23  from _version import __version__ 
24  import nma 
25  import prowl 
26  import pushover 
27   
28   
29  logger = logging.getLogger(__package__) 
30   
31   
32 -def get_client(type_, developerkey='', application=''):
33 """Get a pushnotify client of the specified type. 34 35 Args: 36 type_: A string containing the type of client to get. Valid 37 types are 'nma,' 'prowl,', and 'pushover,' for Notify My 38 Android, Prowl, and Pushover clients, respectively. 39 developerkey: A string containing a valid developer key for the 40 given type_ of client. 41 application: A string containing the name of the application on 42 behalf of whom the client will be sending messages. 43 44 Returns: 45 An nma.Client, prowl.Client, or pushover.Client. 46 47 """ 48 49 type_ = type_.lower() 50 51 if type_ == 'nma': 52 return nma.Client(developerkey, application) 53 elif type_ == 'prowl': 54 return prowl.Client(developerkey, application) 55 elif type_ == 'pushover': 56 return pushover.Client(developerkey, application)
57 58 59 if __name__ == '__main__': 60 pass 61