Skip to content

Commit

Permalink
Merge branch 'master' of github.com:barseghyanartur/pif
Browse files Browse the repository at this point in the history
  • Loading branch information
barseghyanartur committed Jan 23, 2016
2 parents 5a846b0 + 4b9065d commit d6685b6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Empty file.
33 changes: 33 additions & 0 deletions src/pif/checkers/myexternalip/pif_ip_checker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from __future__ import print_function

__title__ = 'pif.checkers.myexternalip.com.pif_ip_checker'
__author__ = 'Syradium'
__copyright__ = 'Copyright (c) 2016 Syradium'
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = ('MyExternalIPChecker',)

from requests import get
from pif.base import BasePublicIPChecker, registry


class MyExternalIPChecker(BasePublicIPChecker):
"""
Checks IPs using myexternalip.com.
"""
uid = 'myexternalip.com'

def get_public_ip(self):
"""
Gets public IP.
:return str:
"""
try:
data = get('http://myexternalip.com/raw').text.rstrip()
return data
except Exception as e:
if self.verbose:
print(e)


registry.register(MyExternalIPChecker)

0 comments on commit d6685b6

Please sign in to comment.