我有一个示例python脚本,我试图使用newtonsoft将其转换为c#:
import urllib
import urllib2
import json
url = 'http://server.net/fcgi/scrut_fcgi.fcgi'
report_details = {
'reportTypeLang' : 'conversations',
'reportDirections' : {
'selected' : 'inbound'
},
'times' : {
'dateRange' : 'Last5Minutes'
},
'filters' : {
'sdfDips_0' : 'in_AC10033A_AC10033A-410'
},
'dataGranularity' : {
'selected' : 'auto'
}
}
data_i_need = {
'inbound' : {
'table' : {
'query_limit' : {
'offset' : 0,
'max_num_rows' : 1
}
}
},
'outbound' : {
'table' : {
'query_limit' : {
'offset' : 0,
'max_num_rows' : 1
}
}
}
}
data = {
'rm' : 'report_api',
'action' : 'get',
'rpt_json' : json.dumps( report_details ),
'data_requested' : json.dumps( data_i_need )
}
data = urllib.urlencode( data )
req = urllib2.Request( url, data )
response = urllib2.urlopen( req )
report = response.read()
report_obj = json.loads( report )
到目前为止,在一些帮助下,我得到了以下c代码,但它不像python版本那样返回任何数据,只是错误地认为请求不正确:
^{pr2}$json看起来有什么问题吗?在
谢谢
试试这个。。在
通过将内容类型更改为:
我在与charles进行调试,python版本发布了一个json格式的表单,将c#内容类型更改为匹配,现在开始工作了
非常感谢您的代码和帮助。在
相关问题 更多 >
编程相关推荐