[modules/publicip] quotes
This commit is contained in:
parent
a2865f941d
commit
818c0edbc4
1 changed files with 12 additions and 12 deletions
|
@ -5,7 +5,7 @@ Requires the following python packages:
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
* publicip.region: us-central (default), us-east, us-west, uk, de, pl, nl
|
* publicip.region: us-central (default), us-east, us-west, uk, de, pl, nl
|
||||||
* publicip.service: web address that returns plaintext ip address (ex. "http://l2.io/ip")
|
* publicip.service: web address that returns plaintext ip address (ex. 'http://l2.io/ip')
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -21,16 +21,16 @@ class Module(bumblebee.engine.Module):
|
||||||
super(Module, self).__init__(engine, config,
|
super(Module, self).__init__(engine, config,
|
||||||
bumblebee.output.Widget(full_text=self.public_ip)
|
bumblebee.output.Widget(full_text=self.public_ip)
|
||||||
)
|
)
|
||||||
self._avail_regions = {"us-east":"http://checkip.amazonaws.com",
|
self._avail_regions = {'us-east':'http://checkip.amazonaws.com',
|
||||||
"us-central":"http://whatismyip.akamai.com",
|
'us-central':'http://whatismyip.akamai.com',
|
||||||
"us-west":"http://ipv4bot.whatismyipaddress.com",
|
'us-west':'http://ipv4bot.whatismyipaddress.com',
|
||||||
"pl":"http://ip.42.pl/raw",
|
'pl':'http://ip.42.pl/raw',
|
||||||
"de":"http://myexternalip.com/raw",
|
'de':'http://myexternalip.com/raw',
|
||||||
"nl":"http://tnx.nl/ip",
|
'nl':'http://tnx.nl/ip',
|
||||||
"uk":"http://ident.me"}
|
'uk':'http://ident.me'}
|
||||||
self._region = self.parameter("region", "us-central")
|
self._region = self.parameter('region', 'us-central')
|
||||||
self._service = self.parameter("service", "")
|
self._service = self.parameter('service', '')
|
||||||
self._ip = ""
|
self._ip = ''
|
||||||
|
|
||||||
|
|
||||||
def public_ip(self, widget):
|
def public_ip(self, widget):
|
||||||
|
@ -44,4 +44,4 @@ class Module(bumblebee.engine.Module):
|
||||||
self.address = self._avail_regions[self._region]
|
self.address = self._avail_regions[self._region]
|
||||||
self._ip = get(self.address).text.rstrip()
|
self._ip = get(self.address).text.rstrip()
|
||||||
except Exception:
|
except Exception:
|
||||||
self._ip = "No Connection"
|
self._ip = 'No Connection'
|
||||||
|
|
Loading…
Reference in a new issue