File size: 675 Bytes
4223796
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
with open(r'E:\crowdata\backend\app\utils\http_client.py', 'rb') as f:
    c = f.read()
with open('debug_output.txt', 'w') as out:
    out.write(f'Total length: {len(c)}\n')
    out.write(f'First 200 bytes: {c[:200]!r}\n')
    out.write(f'Has BOM: {c.startswith(b"\xef\xbb\xbf")}\n')
    idx = c.find(b'headers={')
    if idx >= 0:
        out.write(f'Found at index {idx}\n')
        out.write(c[idx:idx+200].decode('utf-8', errors='replace'))
    else:
        out.write('Not found\n')
    # Check for non-ASCII
    for i, b in enumerate(c):
        if b >= 128:
            out.write(f'Non-ASCII at {i}: 0x{b:02x} ({chr(c[i]) if c[i] < 256 else "?"})\n')
            break