File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3636 install_requires = '''
3737 enum34 >=1.0.3
3838 feedparser >=4.1
39+ requests >=2.23.0
3940 ''' ,
4041 entry_points = {
4142 'console_scripts' : [ 'flashbake = flashbake.console:main' ,
Original file line number Diff line number Diff line change @@ -120,10 +120,10 @@ def init(self):
120120 if isinstance (plugin , flashbake .plugins .AbstractMessagePlugin ):
121121 logging .debug ("Message Plugin: %s" % plugin_name )
122122 # TODO add notion of dependency for ordering
123- if 'flashbake.plugins.location:Location' == plugin_name :
124- self .msg_plugins .insert (0 , plugin )
125- else :
126- self .msg_plugins .append (plugin )
123+ # if 'flashbake.plugins.location:Location' == plugin_name:
124+ # self.msg_plugins.insert(0, plugin)
125+ # else:
126+ self .msg_plugins .append (plugin )
127127 if isinstance (plugin , flashbake .plugins .AbstractFilePlugin ):
128128 logging .debug ("File Plugin: %s" % plugin_name )
129129 self .file_plugins .append (plugin )
Original file line number Diff line number Diff line change 2626import re
2727import urllib
2828import urllib2
29+ from requests import get
2930
3031
3132
@@ -141,26 +142,10 @@ def __get_text(self, node_list):
141142 return text_value
142143
143144 def __get_ip (self ):
144- no_reply = 'http://www.noreply.org'
145- opener = urllib2 .build_opener (urllib2 .HTTPCookieProcessor ())
145+ ip_me = get ('https://api.ipify.org' ).text
146146
147147 try :
148- # open the weather API page
149- ping_reply = opener .open (urllib2 .Request (no_reply )).read ()
150- hello_line = None
151- for line in ping_reply .split ('\n ' ):
152- if line .find ('Hello' ) > 0 :
153- hello_line = line .strip ()
154- break
155- if hello_line is None :
156- logging .error ('Failed to parse Hello with public IP address.' )
157- return None
158- logging .debug (hello_line )
159- m = re .search ('([0-9]+\.){3}([0-9]+){1}' , hello_line )
160- if m is None :
161- logging .error ('Failed to parse Hello with public IP address.' )
162- return None
163- ip_addr = m .group (0 )
148+ ip_addr = ip_me
164149 return ip_addr
165150 except HTTPError , e :
166151 logging .error ('Failed with HTTP status code %d' % e .code )
You can’t perform that action at this time.
0 commit comments