本文整理汇总了Python中pyrax.utils.iso_time_string函数的典型用法代码示例。如果您正苦于以下问题:Python iso_time_string函数的具体用法?Python iso_time_string怎么用?Python iso_time_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了iso_time_string函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: changes_since
def changes_since(self, domain, date_or_datetime):
"""
Gets the changes for a domain since the specified date/datetime.
The date can be one of:
- a Python datetime object
- a Python date object
- a string in the format 'YYYY-MM-YY HH:MM:SS'
- a string in the format 'YYYY-MM-YY'
It returns a list of dicts, whose keys depend on the specific change
that was made. A simple example of such a change dict:
{u'accountId': 000000,
u'action': u'update',
u'changeDetails': [{u'field': u'serial_number',
u'newValue': u'1354038941',
u'originalValue': u'1354038940'},
{u'field': u'updated_at',
u'newValue': u'Tue Nov 27 17:55:41 UTC 2012',
u'originalValue': u'Tue Nov 27 17:55:40 UTC 2012'}],
u'domain': u'example.com',
u'targetId': 00000000,
u'targetType': u'Domain'}
"""
domain_id = utils.get_id(domain)
dt = utils.iso_time_string(date_or_datetime, show_tzinfo=True)
uri = "/domains/%s/changes?since=%s" % (domain_id, dt)
resp, body = self.api.method_get(uri)
return body.get("changes", [])
示例2: test_time_string_datetime_hide_tz
def test_time_string_datetime_hide_tz(self):
class TZ(datetime.tzinfo):
def utcoffset(self, dt):
return datetime.timedelta(minutes=-120)
dt = datetime.datetime(1999, 12, 31, 23, 59, 59, tzinfo=TZ())
self.assertEqual(utils.iso_time_string(dt, show_tzinfo=False), "1999-12-31T23:59:59")
示例3: test_time_string_datetime_add_tz
def test_time_string_datetime_add_tz(self):
dt = "1999-12-31 23:59:59"
self.assertEqual(utils.iso_time_string(dt, show_tzinfo=True),
"1999-12-31T23:59:59+0000")
示例4: test_time_string_datetime
def test_time_string_datetime(self):
dt = "1999-12-31 23:59:59"
self.assertEqual(utils.iso_time_string(dt), "1999-12-31T23:59:59")
示例5: test_time_string_date_obj
def test_time_string_date_obj(self):
dt = datetime.date(1999, 12, 31)
self.assertEqual(utils.iso_time_string(dt), "1999-12-31T00:00:00")
示例6: test_time_string_date
def test_time_string_date(self):
dt = "1999-12-31"
iso = utils.iso_time_string(dt)
self.assertEqual(iso, "1999-12-31T00:00:00")
示例7: test_time_string_empty
def test_time_string_empty(self):
testval = None
self.assertEqual(utils.iso_time_string(testval), "")