示例#1
0
文件: util.py 项目: DrDMoney/okcupyd
def scrub_response(response):
    if not SHOULD_SCRUB:
        return response
    response = response.copy()
    response = scrub_response_headers(response)

    body = response['body']['string']
    try:
        body = zlib.decompress(response['body']['string'], WBITS).decode('utf8')
    except:
        should_recompress = False
    else:
        should_recompress = True

    body = replace_json_fields(body)
    body = util.replace_all_case_insensitive(body, settings.USERNAME,
                                             TESTING_USERNAME)

    if should_recompress:
        body = gzip_string(body)
    response['body']['string'] = body
    return response
示例#2
0
文件: util.py 项目: somaddict/okcupyd
def scrub_response(response):
    if not SHOULD_SCRUB:
        return response
    response = response.copy()
    response = scrub_response_headers(response)

    body = response['body']['string']
    try:
        body = zlib.decompress(response['body']['string'],
                               WBITS).decode('utf8')
    except:
        should_recompress = False
    else:
        should_recompress = True

    body = replace_json_fields(body)
    body = util.replace_all_case_insensitive(body, settings.USERNAME,
                                             TESTING_USERNAME)

    if should_recompress:
        body = gzip_string(body)
    response['body']['string'] = body
    return response
示例#3
0
文件: util.py 项目: DrDMoney/okcupyd
def scrub_uri(uri):
    replaced = util.replace_all_case_insensitive(uri, settings.USERNAME,
                                                 TESTING_USERNAME)
    return util.replace_all_case_insensitive(replaced, settings.PASSWORD,
                                             TESTING_PASSWORD)
示例#4
0
文件: util.py 项目: somaddict/okcupyd
def scrub_uri(uri):
    replaced = util.replace_all_case_insensitive(uri, settings.USERNAME,
                                                 TESTING_USERNAME)
    return util.replace_all_case_insensitive(replaced, settings.PASSWORD,
                                             TESTING_PASSWORD)