示例#1
0
def tryset(name, s, count = 10):
    try:
        setJson(name, s)
    except:
        if count < 0:
            print('Server is gone')
            sys.exit(0)
        tryset(name, s, count - 1)
示例#2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from test import link, getJson, setJson
import urllib
import sys
import time


def tryset(name, s, count = 10):
    try:
        setJson(name, s)
    except:
        if count < 0:
            print('Server is gone')
            sys.exit(0)
        tryset(name, s, count - 1)


f = open('processed.txt')
for s in f:
    if s:
        name = ''
        for i in range(2, len(s) - 2):
            if s[i] == '"' and not s[i-1] == '\\':
                break
            name += s[i]
        name = urllib.parse.quote_plus(name)
        setJson(name, s)
        time.sleep(0.01)