summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--__pycache__/index.cpython-311.pycbin0 -> 3094 bytes
-rw-r--r--index.py9
-rw-r--r--test.zig25
3 files changed, 31 insertions, 3 deletions
diff --git a/__pycache__/index.cpython-311.pyc b/__pycache__/index.cpython-311.pyc
new file mode 100644
index 0000000..bc4a0df
--- /dev/null
+++ b/__pycache__/index.cpython-311.pyc
Binary files 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);
+ }
+}
+