我想使用机器人将这个 HTML 中的照片发送到一个电报组,然后我在这个论坛中发现这段代码工作正常,但是在我提交表单后,浏览器打开一个新选项卡,然后显示一个 JSON 响应
提交表单后我想要的只是import asyncio
import json
from aiokafka import AIOKafkaConsumer,AIOKafkaProducer
async def main():
topic = "test"
producer = AIOKafkaProducer(bootstrap_servers="localhost:29092")
await producer.start()
payload = {"type": "changes","scores": {"foo": 5}}
await producer.send_and_wait(topic,bytes(json.dumps(payload),"utf-8"))
payload = {"type": "snapshot","scores": {"foo": 10,"bar": 20}}
await producer.send_and_wait(topic,"utf-8"))
payload = {"type": "changes","scores": {"baz": 15}}
await producer.send_and_wait(topic,"scores": {"foo": 20,"bar": 30,"baz": 30}}
await producer.send_and_wait(topic,"scores": {"baz": 45}}
await producer.send_and_wait(topic,"utf-8"))
consumer = AIOKafkaConsumer(topic,bootstrap_servers="localhost:29092")
await consumer.start()
while True:
message = await consumer.getone()
print("message:",message.value)
# HOW TO: Start consuming from `{"type": "snapshot","baz": 30}}`
if __name__ == "__main__":
asyncio.run(main())
我该怎么办?
alert('photo has been sent!')