Ejemplo n.º 1
0
 def __req__JuheCharconvert(cls):
     key = cls.__md5__(JWords.rand_lowers(1, 32))
     text = JWords.rand_lowers(1, 64)
     type = random.randint(0, 2)
     return {
         'url': 'http://japi.juhe.cn/charconvert/change.from',
         'args': {
             'key': key,
             'text': text,
             'type': type
         },
         'method': 'UBGET'
     }
Ejemplo n.º 2
0
 def __req__JuheXhzd(cls):
     key = cls.__md5__(JWords.rand_lowers(1, 32))
     word = JWords.rand_lowers(1, 64)
     dtype = random.choice(('xml', 'json'))
     return {
         'url': 'http://v.juhe.cn/xhzd/query',
         'args': {
             'key': key,
             'word': word,
             'dtype': dtype
         },
         'method': 'UBGET'
     }
Ejemplo n.º 3
0
 def __req__GoogleTranslate(cls):
     text = ''
     for i in range(random.randint(1, 10)):
         text += JWords.rand_lowers(3, 8) + ' '
     import urllib.parse
     text = urllib.parse.quote(text)
     hl = random.choice(('ko', 'ja', 'de', 'it', 'fr'))
     sl = random.choice(('nl', 'en', 'lt', 'ar', 'fi'))
     tl = random.choice(('ko', 'ja', 'de', 'it', 'fr'))
     ie = 'UTF-8'
     oe = 'UTF-8'
     return {
         'url': 'http://translate.google.cn/translate_a/t',
         'args': {
             'client': 't',
             'text': text,
             'hl': hl,
             'sl': sl,
             'tl': tl,
             'ie': ie,
             'oe': oe,
             'multires': 1,
             'otf': 1,
             'pc': 1,
             'it': 'srcd_gms.1378',
             'ssel': 4,
             'tsel': 6,
             'sc': 1
         },
         'method': 'UBGET'
     }
Ejemplo n.º 4
0
 def __req__BaiduAqi(cls):
     apikey = cls.__md5__(JWords.rand_lowers(1, 32))
     return {
         'url': 'http://apis.baidu.com/netpopo/aqi/city',
         'args': {
             'apikey': apikey
         },
         'method': 'UBGET'
     }
Ejemplo n.º 5
0
 def __req__BaiduOCR(cls):
     return {
         'url': 'http://apis.baidu.com/idl_baidu/baiduocrpay/idlocrpaid',
         'args': {
             'apikey':
             cls.__md5__(JWords.rand_lowers(1, 32)),
             'fromdevice':
             random.choice(('iPhone', 'iPad')),
             'clientip':
             '10.10.10.0',
             'detecttype':
             'LocateRecognize',
             'imagetype':
             1,
             'image':
             base64.encodebytes(
                 JWords.rand_lowers(1, 1000).encode('utf-8'))
         },
         'method': 'UBPOST'
     }
Ejemplo n.º 6
0
 def __req__JuheCalendar(cls):
     key = cls.__md5__(JWords.rand_lowers(1, 32))
     date = '%d-%d-%d' % (random.randint(2012, 2020), random.randint(
         1, 12), random.randint(1, 30))
     return {
         'url': 'http://v.juhe.cn/calendar/day',
         'args': {
             'key': key,
             'date': date
         },
         'method': 'UBPOST'
     }
Ejemplo n.º 7
0
 def __req__BaiduWeather(cls):
     apikey = cls.__md5__(JWords.rand_lowers(1, 32))
     area = random.randint(101010100, 909090900)
     return {
         'url':
         'http://apis.baidu.com/tianyiweather/basicforecast/weatherapi',
         'args': {
             'apikey': apikey,
             'area': area
         },
         'method': 'UBGET'
     }
Ejemplo n.º 8
0
 def __req__JinShanCiBa(cls):
     id = random.randint(10000, 99999)
     name = JWords.rand_lowers(6, 20)
     auth = cls.__md5__(str(id) + name).upper()
     return {
         'url': 'http://open.iciba.com/ds_open.php',
         'args': {
             'id': id,
             'name': name,
             'auth': auth
         },
         'method': 'UBGET'
     }
Ejemplo n.º 9
0
 def __req__BaiduAstro(cls):
     apikey = cls.__md5__(JWords.rand_lowers(1, 32))
     astroid = random.randint(1, 12)
     date = '""'
     return {
         'url': 'http://apis.baidu.com/netpopo/astro/fortune',
         'args': {
             'apikey': apikey,
             'astroid': astroid,
             'date': date
         },
         'method': 'UBGET'
     }
Ejemplo n.º 10
0
 def __req__BaiduTodayhistory(cls):
     apikey = cls.__md5__(JWords.rand_lowers(1, 32))
     month = random.randint(1, 12)
     day = random.randint(1, 30)
     return {
         'url': 'http://apis.baidu.com/netpopo/todayhistory/query',
         'args': {
             'apikey': apikey,
             'month': month,
             'day': day
         },
         'method': 'UBGET'
     }
Ejemplo n.º 11
0
 def __req__BaiduTranslate(cls):
     text = ''
     for i in range(random.randint(1, 10)):
         text += JWords.rand_lowers(3, 8) + ' '
     hl = random.choice(('ko', 'ja', 'de', 'it', 'fr'))
     sl = random.choice(('nl', 'en', 'lt', 'ar', 'fi'))
     tl = random.choice(('ko', 'ja', 'de', 'it', 'fr'))
     return {
         'url': 'http://fanyi.baidu.com/translate',
         'args': {
             'query': 1,
             'keyfrom': 'baidu',
             'smartresult': 'dict',
             'lang': 'auto2%s#%s/%s/%s' % (hl, sl, tl, text)
         },
         'method': 'UBGET'
     }
Ejemplo n.º 12
0
 def __req__JuheJoke(cls):
     key = cls.__md5__(JWords.rand_lowers(1, 32))
     pagesize = random.randint(1, 20)
     page = random.randint(1, pagesize)
     sort = random.choice(('desc', 'asc'))
     ts = time.time()
     return {
         'url': 'http://v.juhe.cn/joke/content/list.php',
         'args': {
             'key': key,
             'page': page,
             'pagesize': pagesize,
             'sort': sort,
             'time': time
         },
         'method': 'UBGET'
     }
Ejemplo n.º 13
0
 def rand_file_ext(left=2, min_right=3, right_float=3):
     return '.' + JWords.rand_lowers(
         left, min_right + JRand.rand_nearest(right_float))
Ejemplo n.º 14
0
 def randValue(cls, t):
     # OC对象类型
     if t.startswith('NS'):
         if ('NSString*' == t):
             r = random.random()
             if (r < 0.03):
                 return 'nil'
             elif (r < 0.8):
                 s = '@"' + JWords.hump(OC_LSTR[0], OC_LSTR[1], False) + '"'
                 return s
             else:
                 s = '@"' + JWords.hump(OC_LSTR[0], OC_LSTR[1], False) + '"'
                 if (random.random() < 0.5):
                     d = str(random.random() * OC_LNUM[1] * 2 - OC_LNUM[0])
                     return '[NSString stringWithFormat:@"%@_(%f)",' + s + ',' + d + ']'
                 else:
                     d = str(random.randint(OC_LNUM[0], OC_LNUM[1]))
                     return '[NSString stringWithFormat:@"%@_(%d)",' + s + ',' + d + ']'
         if t.endswith('Dictionary*'):
             if (random.random() < 0.5):
                 return 'nil'
             else:
                 s = '[' + t[:-1] + ' dictionaryWithObjectsAndKeys:'
                 if (random.random() < 0.8):
                     for i in range(random.randint(OC_LSET[0], OC_LSET[1])):
                         s += '@(' + str(i) + '),'
                         s += '@"' + JWords.rand_lowers(1, 10) + '",'
                 else:
                     for i in range(random.randint(OC_LSET[0], OC_LSET[1])):
                         s += '@(' + str(i) + '),'
                         s += '@(' + str(i) + '),'
                 s += 'nil]'
                 return s
         if t.endswith('Array*'):
             if (random.random() < 0.5):
                 return 'nil'
             else:
                 s = '[' + t[:-1] + ' arrayWithObjects:'
                 if (random.random() < 0.8):
                     for i in range(random.randint(OC_LSET[0], OC_LSET[1])):
                         s += '@"' + JWords.rand_lowers(1, 10) + '",'
                 else:
                     for i in range(random.randint(OC_LSET[0], OC_LSET[1])):
                         s += '@(' + str(i) + '),'
                 s += 'nil]'
                 return s
     # 布尔值
     if ('BOOL' == t):
         return random.choice(OC_BOOL)
     # 字符数组
     if ('const char*' == t):
         if (random.random() < 0.03):
             return 'NULL'
         else:
             return '"' + JWords.hump(OC_LSTR[0], OC_LSTR[1], False) + '"'
     # 数值类型数据
     if (cls.isFloat(t)):
         f = random.random() * OC_LNUM[1] * 2 - OC_LNUM[0]
         return str(round(f, random.randint(1, 4)))
     else:
         return str(random.randint(OC_LNUM[0], OC_LNUM[1]))