| Age | Commit message (Collapse) | Author |
|
Conflicts:
pushover.py
use `value is True` instead of `value == True`
|
|
|
|
|
|
Convenience function to create a client
|
|
|
|
(self.answer is a dict)
|
|
I think it makes sense to init() in here too, and allow the user to keep the api_tokens in the config file.
|
|
I think this is supposed to be a return rather than a print. Print returns none and string serialization fails.
|
|
|
|
Loads a config file at and creates a client according to various options. Handy IMO so you don't have to constantly look up your user key etc. Has some precedent in a similar system used by boto for AWS credentials (http://boto.readthedocs.org/en/latest/boto_config_tut.html)
|
|
We need to test boolean only :
>>> key="timestamp"
>>> value="123456"
>>>
>>> if key == "timestamp" and value:
... print "Value <> True but, still true"
... else:
... print "value <> True and false"
...
Value <> True but, still true
|
|
With the original version i got :
python /usr/lib/python2.6/site-packages/pushover.py --token "NU2LC5g2G9jgVR9eHVLYAUmkFuPeky" --client "FWhJFb5wgV35bmzmaxeV976K1WqaFE" "Hello"
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/pushover.py", line 227, in <module>
url_title=args.url_title, timestamp=True)
File "/usr/lib/python2.6/site-packages/pushover.py", line 207, in send_message
return MessageRequest(payload)
File "/usr/lib/python2.6/site-packages/pushover.py", line 104, in __init__
Request.__init__(self, "post", MESSAGE_URL, payload)
File "/usr/lib/python2.6/site-packages/pushover.py", line 86, in __init__
raise RequestError(self.answer["errors"])
__main__.RequestError:
==> timestamp is invalid
By casting time.time() the error disappears
|
|
With the original version i got :
python /usr/lib/python2.6/site-packages/pushover.py --token "NU2LC5g2G9jgVR9eHVLYAUmkFuPeky" --client "FWhJFb5wgV35bmzmaxeV976K1WqaFE" "Hello"
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/pushover.py", line 227, in <module>
url_title=args.url_title, timestamp=True)
File "/usr/lib/python2.6/site-packages/pushover.py", line 207, in send_message
return MessageRequest(payload)
File "/usr/lib/python2.6/site-packages/pushover.py", line 104, in __init__
Request.__init__(self, "post", MESSAGE_URL, payload)
File "/usr/lib/python2.6/site-packages/pushover.py", line 86, in __init__
raise RequestError(self.answer["errors"])
__main__.RequestError:
==> timestamp is invalid
By casting time.time() the error disappears
|
|
|
|
|
|
|
|
|
|
|