| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import json
- import redis
- from configure import REDIS_CFG
- # 使用的键名(原 Channel 名称)
- key = "vs:signal:slot.lon.fr.tourist"
- # 消息体
- message = {
- "group_id": "tls.gb.fr",
- "apt_type": {
- "weight": 10,
- "routing_key": "slot.lon.fr.tourist",
- "city": "London",
- "visa_type": "Tourist",
- "country": "France"
- },
- "query_result": {
- "routing_key": "slot.lon.fr.tourist",
- "country": "France",
- "city": "London",
- "visa_type": "Tourist",
- "availability_status": "Available",
- "earliest_date": "2026-06-06",
- "availability": [
- {
- "date": "2026-06-06",
- "times": [
- {
- "time": "16:30",
- "label": ""
- }
- ]
- }
- ],
- "snapshot_source": "worker",
- "snapshot_at": "2026-05-02T14:23:45.123456+00:00"
- },
- "timestamp": 1777745853
- }
- def main():
- r = redis.Redis(**REDIS_CFG, decode_responses=True)
- r.setex(key, 30, json.dumps(message, ensure_ascii=False))
- print(f"写入成功 -> 键: {key}")
- print("有效期: 30 秒")
- if __name__ == "__main__":
- main()
|