|
14 | 14 | import time |
15 | 15 | import argparse |
16 | 16 | import getpass |
17 | | -from distutils.version import StrictVersion |
18 | 17 | import urllib.parse |
19 | 18 | import requests |
20 | 19 |
|
@@ -150,51 +149,6 @@ def parse_arguments(): |
150 | 149 | return args |
151 | 150 |
|
152 | 151 |
|
153 | | -def check_li2u_version(): |
154 | | - """Checks GitHub for a new version |
155 | | -
|
156 | | - Uses a simple regex to look at the 'releases' page on GitHub. Extracts the |
157 | | - First tag found and assumes it is the latest. Compares with the global |
158 | | - variable CURRENT_TAG and informs if a new version is available. |
159 | | - """ |
160 | | - latest_rel_regex = r'/initstring/linkedin2username/tree/(.*?)"' |
161 | | - session = requests.session() |
162 | | - rel_url = 'https://github.com/initstring/linkedin2username/releases' |
163 | | - rel_chars = re.compile(r'[^0-9\.]') |
164 | | - |
165 | | - # Scrape the page and grab the regex. |
166 | | - response = session.get(rel_url) |
167 | | - latest_rel = re.findall(latest_rel_regex, response.text) |
168 | | - |
169 | | - # Remove characters from tag name that will mess up version comparison. |
170 | | - # Also just continue if we can't find the tags - we don't want that small |
171 | | - # function to break the entire app. |
172 | | - if latest_rel[0]: |
173 | | - latest_rel = rel_chars.sub('', latest_rel[0]) |
174 | | - else: |
175 | | - return |
176 | | - |
177 | | - # Check the tag found with the one defined in this script. |
178 | | - if CURRENT_REL == latest_rel: |
179 | | - print("") |
180 | | - print(PC.ok_box + "Using version {}, which is the latest on" |
181 | | - " GitHub.\n".format(CURRENT_REL)) |
182 | | - return |
183 | | - if StrictVersion(CURRENT_REL) > StrictVersion(latest_rel): |
184 | | - print("") |
185 | | - print(PC.warn_box + "Using version {}, which is NEWER than {}, the" |
186 | | - " latest official release. Good luck!\n" |
187 | | - .format(CURRENT_REL, latest_rel)) |
188 | | - return |
189 | | - if StrictVersion(CURRENT_REL) < StrictVersion(latest_rel): |
190 | | - print("") |
191 | | - print(PC.warn_box + "You are using {}, but {} is available.\n" |
192 | | - " LinkedIn changes often - this version may not work.\n" |
193 | | - " https://github.com/initstring/linkedin2username.\n" |
194 | | - .format(CURRENT_REL, latest_rel)) |
195 | | - return |
196 | | - |
197 | | - |
198 | 152 | def login(args): |
199 | 153 | """Creates a new authenticated session. |
200 | 154 |
|
@@ -700,9 +654,6 @@ def main(): |
700 | 654 | print(BANNER + "\n\n\n") |
701 | 655 | args = parse_arguments() |
702 | 656 |
|
703 | | - # Check the version |
704 | | - check_li2u_version() |
705 | | - |
706 | 657 | # Instantiate a session by logging in to LinkedIn. |
707 | 658 | session = login(args) |
708 | 659 |
|
|
0 commit comments