how extract real time form time.gov in python? -
i want show real time in program time.gov. saw ntplib module , example:
import ntplib time import ctime c = ntplib.ntpclient() response = c.request('europe.pool.ntp.org', version=3) ctime(response.tx_time)
but can't use time.gov instead of 'europe.pool.ntp.org' because time.gov not ntp server. saw java script code in page source. there way extract real time time.gov in python or without ntplib?
use urllib retrieve
http://time.gov/actualtime.cgi
that returns this:
<timestamp time="1433396367767836" delay="0"/>
looks microseconds
>>> time.ctime(1433396367.767836) 'thu jun 4 15:39:27 2015'
Comments
Post a Comment