在使用Ocelot向下游发送呼叫之前,如何更改正文内容

时间:2019-09-27 19:29:56

标签: ocelot

我们需要更改主体中的JSON内容,然后再 向下游发送Web服务调用,我们尝试了以下代码,所示代码位于from datetime import date, datetime from functools import partial import os import sys from tkcalendar import Calendar, DateEntry from tkinter import ttk from tkinter import scrolledtext import tkinter as tk def datecheck(date_label): global date_string, timestamp root = tk.Toplevel() s = ttk.Style(root) s.theme_use('clam') def print_sel(): global date_string cal_selection = cal.selection_get() date_string = cal_selection.strftime("%d-%b-%Y") # Update the text on the date label. date_label.configure(text="Date : {}".format(date_string)) root.destroy() today = date.today() d = int(today.strftime("%d")) m = int(today.strftime("%m")) y =int(today.strftime("%Y")) cal = Calendar(root, font="Arial 14", selectmode='day', cursor="hand1", day=d,month=m, year=y) cal.pack(fill="both", expand=True) ttk.Button(root, text="ok", command=print_sel).pack() def homepage(): global date_string, timestamp if date_string == "": timestamp = datetime.now().strftime("%d-%b-%Y") else: timestamp = date_string def close_window(): window.destroy() window = tk.Tk() window.title("Status Uploader") window.geometry('500x200') tk.Label(window, text="Status Uploader", fg="blue", bg="yellow", font="Verdana 10 bold").pack() date_label = tk.Label(window, text="Date : {}".format(timestamp), fg="red", bg="yellow", font="Verdana 10 bold") date_label.pack() # Create callback function for "Choose Date" Button with data_label # positional argument automatically supplied to datecheck() function. datecheck_callback = partial(datecheck, date_label) txt = scrolledtext.ScrolledText(window, width=60, height=9.5) txt.pack() button = tk.Button(window, fg='white', bg='blue', text="Choose Date", command=datecheck_callback) button.place(x=35, y=152) button = tk.Button(window, fg='white', bg='red', text="Close", command=close_window) button.place(x=405, y=152) window.after(1000, fun, window) # Start periodic global variable updates. window.mainloop() def fun(window): """ Updates some global time and date variables. """ global date_string, timestamp if date_string == "": timestamp = datetime.now().strftime("%d-%b-%Y") else: timestamp = date_string window.after(1000, fun, window) # Check again in 1000 milliseconds. # Define globals. date_string = "" timestamp = None homepage() # Run GUI application. 方法内部它运行在Ocelot内部-我们在每次调用中都成功地达到了调试器的中断点-没有错误,但是下游服务仍然获得了原始主体,有什么建议吗?

Configure(app => { ... })

0 个答案:

没有答案