Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 65185b0

Browse files
committed
added function to get the newest version number
1 parent 61492e2 commit 65185b0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

plotly/check_version.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import urllib2 # the lib that handles the url stuff
2+
import re
3+
4+
5+
def get_latest():
6+
data = urllib2.urlopen('https://raw.githubusercontent.com/plotly/plotly.py/master/plotly/version.py') # it's a file like object and works just like a file
7+
version_string = [i for i in data][0]
8+
latest_version = re.findall(r'\'.*', version_string)[0][1:-1]
9+
return latest_version
10+
11+
def run_duration(f, **kwargs):
12+
import timeit
13+
start_time = timeit.default_timer()
14+
f(**kwargs)
15+
return (timeit.default_timer() - start_time)
16+
17+
18+
19+
20+
21+
22+

0 commit comments

Comments
 (0)