我将datasnap rest服务器配置为madexcept的自定义脚本上传位置。
一切正常,直到我尝试解析报表中设置的变量为止。他们添加了
function V1RestMethod.UpdateBugReport: TJSONArray;
var
LReq:TWebRequest;
LAppName:string;
begin
LReq:=GetDataSnapWebModule.Request;
LAppName:= LReq.ContentFields.Values['appname'];
end;
我认识到报告是作为 multipart / form-data 发送的,因此我尝试将 Web.ReqMulti 包含到我的单元中,以使用 TMultipartContentParser进行解析 在REST方法中看起来像这样
LAppName
此时,LReq.ContentFields.Count
为空,因为application/octet-stream
为0
解析此错误报告的推荐方法是什么?
更新_1:
似乎TMultipartContentParser似乎正确解析了所有文件(from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import cm
def random_point( r=1 ):
ct = 2*np.random.rand() - 1
st = np.sqrt( 1 - ct**2 )
phi = 2* np.pi * np.random.rand()
x = r * st * np.cos( phi)
y = r * st * np.sin( phi)
z = r * ct
return np.array( [x, y, z ] )
def near( p, pntList, d0 ):
cnt=0
for pj in pntList:
dist=np.linalg.norm( p - pj )
if dist < d0:
cnt += 1 - dist/d0
return cnt
"""
https://stackoverflow.com/questions/22128909/plotting-the-temperature-distribution-on-a-sphere-with-python
"""
pointList = np.array([ random_point( 10.05 ) for i in range( 65 ) ] )
fig = plt.figure()
ax = fig.add_subplot( 1, 1, 1, projection='3d')
u = np.linspace( 0, 2 * np.pi, 120)
v = np.linspace( 0, np.pi, 60 )
# create the sphere surface
XX = 10 * np.outer( np.cos( u ), np.sin( v ) )
YY = 10 * np.outer( np.sin( u ), np.sin( v ) )
ZZ = 10 * np.outer( np.ones( np.size( u ) ), np.cos( v ) )
WW = XX.copy()
for i in range( len( XX ) ):
for j in range( len( XX[0] ) ):
x = XX[ i, j ]
y = YY[ i, j ]
z = ZZ[ i, j ]
WW[ i, j ] = near(n p.array( [x, y, z ] ), pointList, 3)
WW = WW / np.amax( WW )
myheatmap = WW
# ~ ax.scatter( *zip( *pointList ), color='#dd00dd' )
ax.plot_surface( XX, YY, ZZ, cstride=1, rstride=1, facecolors=cm.jet( myheatmap ) )
plt.show()
),但未解析纯文本。