def firefox(cls): ver = ( 'Gecko/{0} Firefox/{1}.0'.format( DatetimeProvider.date_time_between(datetime(2011, 1, 1)), random.randint(4, 15)), 'Gecko/{0} Firefox/3.6.{1}'.format( DatetimeProvider.date_time_between(datetime(2010, 1, 1)), random.randint(1, 20)), 'Gecko/{0} Firefox/3.8'.format( DatetimeProvider.date_time_between(datetime(2010, 1, 1)), ), ) tmplt_win = '({0}; {1}; rv:1.9.{2}.20) {3}' tmplt_lin = '({0}; rv:1.9.{1}.20) {2}' tmplt_mac = '({0}; rv:1.9.{1}.20) {2}' platforms = ( tmplt_win.format(cls.windows_platform_token(), MiscProvider.locale().replace('_', '-'), random.randint(0, 2), random.choice(ver)), tmplt_lin.format(cls.linux_platform_token(), random.randint(5, 7), random.choice(ver)), tmplt_mac.format(cls.mac_platform_token(), random.randint(2, 6), random.choice(ver)), ) return 'Mozilla/5.0 ' + cls.random_element(platforms)
def firefox(cls): ver = ( 'Gecko/{0} Firefox/{1}.0'.format( DatetimeProvider.date_time_between( datetime(2011, 1, 1)), random.randint(4, 15)), 'Gecko/{0} Firefox/3.6.{1}'.format( DatetimeProvider.date_time_between( datetime(2010, 1, 1)), random.randint(1, 20)), 'Gecko/{0} Firefox/3.8'.format( DatetimeProvider.date_time_between( datetime(2010, 1, 1)), ), ) tmplt_win = '({0}; {1}; rv:1.9.{2}.20) {3}' tmplt_lin = '({0}; rv:1.9.{1}.20) {2}' tmplt_mac = '({0}; rv:1.9.{1}.20) {2}' platforms = ( tmplt_win.format(cls.windows_platform_token(), cls.random_element(cls.langs), random.randint(0, 2), random.choice(ver)), tmplt_lin.format(cls.linux_platform_token(), random.randint(5, 7), random.choice(ver)), tmplt_mac.format(cls.mac_platform_token(), random.randint(2, 6), random.choice(ver)), ) return 'Mozilla/5.0 ' + cls.random_element(platforms)
def credit_card_expire(cls, start='now', end='+10y', date_format='%m/%y'): expire_date = DateTimeProvider.date_time_between(start, end) return expire_date.strftime(date_format)