import os
os.environ['TZ'] = 'America/Montevideo' # very important to set your time zone
os.system('ntpdate -s south-america.pool.ntp.org')
print 'Time changed to: '
os.system('date')
import requests
from requests_kerberos import HTTPKerberosAuth
r = requests.get('http://timeapi.org/utc/now.json?callback=myCallback', auth=('user', 'pass')
data = r.json()
此python代码将帮助您:
您可以使用restwebservice(Python有json api,但您可以简单地使用'requests'libs)
对于这里的web服务(感谢http://www.timeapi.org/): http://timeapi.org/utc/now.json?callback=myCallback
相关问题 更多 >
编程相关推荐