From fb0a9f51c3c719ceda3ada03fa2171b4dc26ea69 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 3 Sep 2023 10:05:44 +0800 Subject: updated --- __pycache__/index.cpython-311.pyc | Bin 0 -> 3094 bytes index.py | 9 ++++++--- test.zig | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 __pycache__/index.cpython-311.pyc create mode 100644 test.zig diff --git a/__pycache__/index.cpython-311.pyc b/__pycache__/index.cpython-311.pyc new file mode 100644 index 0000000..bc4a0df Binary files /dev/null and b/__pycache__/index.cpython-311.pyc differ diff --git a/index.py b/index.py index 6c10480..f54c216 100644 --- a/index.py +++ b/index.py @@ -1,10 +1,10 @@ from flask import Flask, request import requests -app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 - app = Flask(__name__) +app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 + # Set up the necessary variables token = "MTE0MTM0MDA2Mzk2ODU0MjczMA.GX75jG.frFFekrXjqk1BrAuTftSYClt1ERQn8BY2FiZgg" channel_id = '1140989222556274721' @@ -24,7 +24,10 @@ def handle_post_request(): 'content': "cao" } requests.post(url, headers=header, data=dbug)#DEBUGGGG======= - message = request.get_data().decode('utf-8') + try: + message = request.get_data().decode('utf-8') + except UnicodeDecodeError: + message = request.get_data() requests.post(url, headers=header, data=dbug)#DEBUGGGG======= isFile = False diff --git a/test.zig b/test.zig new file mode 100644 index 0000000..d59ea17 --- /dev/null +++ b/test.zig @@ -0,0 +1,25 @@ +const std = @import("std"); +const parseInt = std.fmt.parseInt; + +test "parse integers" { + const input = "123 67 89,99"; + const ally = std.testing.allocator; + + var list = std.ArrayList(u32).init(ally); + // Ensure the list is freed at scope exit. + // Try commenting out this line! + defer list.deinit(); + + var it = std.mem.tokenize(u8, input, " ,"); + while (it.next()) |num| { + const n = try parseInt(u32, num, 10); + try list.append(n); + } + + const expected = [_]u32{ 123, 67, 89, 99 }; + + for (expected, list.items) |exp, actual| { + try std.testing.expectEqual(exp, actual); + } +} + -- cgit v1.2.3