grpc通话,请参阅grpc通话的正文/流

时间:2019-01-05 14:32:12

标签: android sdk grpc grpc-python

我正在将Anki Vector SDK与Python结合使用以访问Anki Vector机器人。 但是,SDK仅限于Python,我想为Vector编写Android应用。 因此,我试图找出API端点及其参数以及如何使用它们。不幸的是,Anki在其SDK上使用了GRPC来访问API端点。他们还提供了一些原始文件以与其他语言一起使用。但是,我不明白如何使用它们。

相反,我尝试使用以下环境变量进行GRPC跟踪:

export GRPC_VERBOSITY=DEBUG
//export GRPC_TRACE=list_tracers
//export GRPC_TRACE=all 
export GRPC_TRACE=http

我可以使用此方法获取HTTP调用的标头。 (下面的示例跟踪日志) 但是我看不到HTTP调用的内容(或流内容)

我如何得到它?

  

I0105 16:40:33.658871867 2405 chttp2_transport.cc:1702] perform_stream_op [s = 0x6c90b2d4]:SEND_INITIAL_METADATA {key = 3a 73 63 68 65 6d 65':scheme'value = 68 74 74 70 73'https',key = 3a 6d 65 74 68 6f 64':method'值= 50 4f 53 54'POST',key = 3a 61 75 74 68 6f 72 69 74 79':authority'值= 56 65 63 74 6f 72 2d 4b 38 50 35'Vector-K8P5',key = 3a 70 61 74 68':path'值= 2f 41 6e 6b 69 2e 56 65 63 74 6f 72 2e 65 78 74 65 72 6e 61 6c 5f 69 6e 74 65 72 66 61 63 65 2e 45 78 74 65 72 6e 61 6c 49 6e 74 65 72 66 61 63 65 2f 50 72 6f 74 6f 63 6f 6c 56 65 72 73 69 6f 6e'/Anki.Vector.external_interface.ExternalInterface/ProtocolVersion',key = 61 75 74 68 6f 72 69 7a 61 74 69 6f 6e'授权'值= 42 65 61 72 65 72 20 6e 49 6f 6f 59 43 49 68 54 51 32 30 47 7a 78 78 4c 63 2b 70 53 67 3d 3d'承载nIooYCIhTQ20GzxxLc + pSg ==',key = 74 65'te'值= 74 72 61 69 6c 65 72 73'trailers',key = 63 6f 6e 74 65 6e 74 2d 74 79 70 65'content-type'value = 61 70 70 6c 69 63 61 74 69 6f 6e 2f 67 72 70 63'application / grpc',密钥= 75 73 65 72 2d 61 67 65 6e 74'user-agent'值= 67 72 70 63 2d 70 79 74 68 6f 6e 2f 31 2e 31 37 2e 31 20 67 72 70 63 2d 63 2f 37 2e 30 2e 30 20 28 6c 69 6e 75 78 3b 20 63 68 74 74 70 32 3b 20 67 69 7a 6d 6f 29'grpc-python / 1.17.1 grpc-c / 7.0.0(Linux; chttp2; gizmo)',键= 67 72 70 63 2d 61 63 63 65 70 74 2d 65 6e 63 6f 64 69 6e 67'grpc-accept-encoding'值= 69 64 65 6e 74 69 74 79 2c 64 65 66 6c 61 74 65 2c 67 7a 69 70'identity,deflate,gzip',key = 61 63 63 65 70 74 2d 65 6e 63 6f 64 69 6e 67'accept-encoding'值= 69 64 65 6e 74 69 74 79 2c 67 7a 69 70'identity,gzip'} SEND_MESSAGE:标志= 0x00000000:len = 2 SEND_TRAILING_METADATA {} RECV_INITIAL_METADATA RECV_MESSAGE RECV_TRAILING_METADATA   I0105 16:40:33.659113265 2405 chttp2_transport.cc:1398] perform_stream_op_locked:SEND_INITIAL_METADATA {key = 3a 73 63 68 65 6d 65':scheme'value = 68 74 74 70 73'https',key = 3a 6d 65 74 68 6f 64 ':method'值= 50 4f 53 54'POST',密钥= 3a 61 75 74 68 6f 72 69 74 79':author''值= 56 65 63 74 6f 72 2d 4b 38 50 35'Vector-K8P5',密钥= 3a 70 61 74 68':path'值= 2f 41 6e 6b 69 2e 56 65 63 74 6f 72 2e 65 78 74 65 72 6e 61 6c 5f 69 6e 74 65 72 66 61 63 65 2e 45 78 74 65 72 6e 61 6c 49 6e 74 65 72 66 61 63 65 2f 50 72 6f 74 6f 63 6f 6c 56 65 72 73 69 6f 6e'/Anki.Vector.external_interface.ExternalInterface/ProtocolVersion',key = 61 75 74 68 6f 72 69 7a 61 74 69 6f 6e'授权'值= 42 65 61 72 65 72 20 6e 49 6f 6f 59 43 49 68 54 51 32 30 47 7a 78 78 4c 63 2b 70 53 67 3d 3d'bearer nIooYCIhTQ20GzxxLc + pSg ==', key = 74 65'te'值= 74 72 61 69 6c 65 72 73'trailers',key = 63 6f 6e 74 65 6e 74 2d 74 79 70 65'content-type'值= 61 70 70 6c 69 63 61 74 69 6f 6e 2f 67 72 70 63'适用ation / grpc',密钥= 75 73 65 72 2d 61 67 65 6e 74'user-agent'值= 67 72 70 63 2d 70 79 74 68 6f 6e 2f 31 2e 31 37 2e 31 20 67 72 70 63 2d 63 2f 37 2e 30 2e 30 20 28 6c 69 6e 75 78 3b 20 63 68 74 74 70 32 3b 20 67 69 7a 6d 6f 29'grpc-python / 1.17.1 grpc-c / 7.0.0(Linux; chttp2; gizmo)',键= 67 72 70 63 2d 61 63 63 65 70 74 2d 65 6e 63 6f 64 69 6e 67'grpc-accept-encoding'值= 69 64 65 6e 74 69 74 79 2c 64 65 66 6c 61 74 65 2c 67 7a 69 70'identity,deflate,gzip',key = 61 63 63 65 70 74 2d 65 6e 63 6f 64 69 6e 67'accept-encoding'值= 69 64 65 6e 74 69 74 79 2c 67 7a 69 70'identity,gzip'} SEND_MESSAGE:flags = 0x00000000:len = 2 SEND_TRAILING_METADATA {} RECV_INITIAL_METADATA RECV_MESSAGE RECV_TRAILING_METADATA; on_complete = 0x6c90b1b4   I0105 16:40:33.659194720 2405 chttp2_transport.cc:1376] HTTP:0:HDR:CLI::scheme:https   I0105 16:40:33.659223208 2405 chttp2_transport.cc:1376] HTTP:0:HDR:CLI::method:POST   I0105 16:40:33.659249145 2405 chttp2_transport.cc:1376] HTTP:0:HDR:CLI::authority:Vector-K8P5   I0105 16:40:33.659274769 2405 chttp2_transport.cc:1376] HTTP:0:HDR:CLI::path:/Anki.Vector.external_interface.ExternalInterface/ProtocolVersion   I0105 16:40:33.659301851 2405 chttp2_transport.cc:1376] HTTP:0:HDR:CLI:授权:承载nIooYCIhTQ20GzxxLc + pSg ==   I0105 16:40:33.659328569 2405 chttp2_transport.cc:1376] HTTP:0:HDR:CLI:te:拖车   I0105 16:40:33.659354193 2405 chttp2_transport.cc:1376] HTTP:0:HDR:CLI:content-type:application / grpc   I0105 16:40:33.659379036 2405 chttp2_transport.cc:1376] HTTP:0:HDR:CLI:用户代理:grpc-python / 1.17.1 grpc-c / 7.0.0(linux; chttp2; gizmo)   I0105 16:40:33.659405129 2405 chttp2_transport.cc:1376] HTTP:0:HDR:CLI:grpc-accept-encoding:identity,deflate,gzip   I0105 16:40:33.659431273 2405 chttp2_transport.cc:1376] HTTP:0:HDR:CLI:accept-encoding:identity,gzip   I0105 16:40:33.659462991 2405 chttp2_transport.cc:1187] HTTP:CLI:将新的grpc_chttp2_stream 0x6c90b2d4分配给ID 1   I0105 16:40:33.659492209 2405 chttp2_transport.cc:852] W:0x6ae19ad8客户端状态IDLE->写[START_NEW_STREAM]   I0105 16:40:33.659522468 2405 chttp2_transport.cc:852] W:0x6ae19ad8客户状态写入->写入+更多[SEND_MESSAGE]   I0105 16:40:33.659557571 2405 chttp2_transport.cc:1249] complete_closure_step:t = 0x6ae19ad8 0x6c90b1b4 refs = 3标志= 0x0001 desc = op-> on_complete err =“ No Error” write_state = WRITING + MORE   I0105 16:40:33.659641005 2397 Writing.cc:413] W:0x6ae19ad8 CLIENT [1] im-(sent,send)=(0,1)announce = 5   I0105 16:40:33.659708711 2397 hpack_encoder.cc:473]编码:':authority:Vector-K8P5',elem_interned = 1 [1],k_interned = 1,v_interned = 1   I0105 16:40:33.659791937 2397 hpack_encoder.cc:473]编码:':path:/Anki.Vector.external_interface.ExternalInterface/ProtocolVersion',elem_interned=0 [2],k_interned = 1,v_interned = 0   I0105 16:40:33.659828134 2397 hpack_encoder.cc:473]编码:“授权:承载nIooYCIhTQ20GzxxLc + pSg ==”,elem_interned = 0 [2],k_interned = 0,v_interned = 0   I0105 16:40:33.659860684 2397 hpack_encoder.cc:473]编码:“ te:trailers”,elem_interned = 1 [3],k_interned = 1,v_interned = 1   I0105 16:40:33.659891308 2397 hpack_encoder.cc:473]编码:“内容类型:应用程序/ grpc”,elem_interned = 1 [3],k_interned = 1,v_interned = 1   I0105 16:40:33.659961983 2397 hpack_encoder.cc:473]编码:“用户代理:grpc-python / 1.17.1 grpc-c / 7.0.0(linux; chttp2; gizmo)”,elem_interned = 1 [1], k_interned = 1,v_interned = 1   I0105 16:40:33.659995888 2397 hpack_encoder.cc:473]编码:“ grpc-accept-encoding:identity,deflate,gzip”,elem_interned = 1 [3],k_interned = 1,v_interned = 1   I0105 16:40:33.660025887 2397 hpack_encoder.cc:473]编码:“接受编码:身份,gzip”,elem_interned = 1 [3],k_interned = 1,v_interned = 1   I0105 16:40:33.660059531 2397 chttp2_transport.cc:1249] complete_closure_step:t = 0x6ae19ad8 0x6c90b1b4 refs = 2标志= 0x0001 desc = send_initial_metadata_finished err =“ No Error” write_state = WRITING + MORE   I0105 16:40:33.660103644 2397 chttp2_transport.cc:1249] complete_closure_step:t = 0x6ae19ad8 0x6c90b1b4 refs = 1标志= 0x0001 desc = send_trailing_metadata_finished err =“ No Error” write_state = WRITING + MORE   I0105 16:40:33.660134112 2397 chttp2_transport.cc:1249] complete_closure_step:t = 0x6ae19ad8 0x6c90b1b4 refs = 0标志= 0x0001 desc = on_write_finished_cb err =“无错误” write_state = WRITING + MORE   I0105 16:40:33.660166923 2397 chttp2_transport.cc:852] W:0x6ae19ad8客户端状态写入+更多->写入[开始在当前线程中写入]   I0105 16:40:33.660500817 2397 chttp2_transport.cc:852] W:0x6ae19ad8客户端状态写入->空闲[完成写入]   I0105 16:40:33.660902208 2400 chttp2_transport.cc:2609] ipv4:192.168.254.44:443:完整的BDP ping err =“ No Error”   I0105 16:40:33.671334525 2400 parsing.cc:656]解析initial_metadata   I0105 16:40:33.671392960 2400 hpack_parser.cc:636]解码:“:状态:200”,elem_interned = 1 [3],k_interned = 1,v_interned = 1   I0105 16:40:33.671427021 2400 parsing.cc:407] HTTP:1:HDR:CLI::status:32 30 30'200'   I0105 16:40:33.671476551 2400 hpack_parser.cc:636]解码:“内容类型:应用程序/ grpc”,elem_interned = 1 [3],k_interned = 1,v_interned = 1   I0105 16:40:33.671506810 2400 parsing.cc:407] HTTP:1:HDR:CLI:content-type:61 70 70 6c 69 63 61 74 69 6f 6e 2f 67 72 70 63'application / grpc'   I0105 16:40:33.671552277 2400 hpack_parser.cc:636]解码:“预告片:Grpc状态”,elem_interned = 1 [1],k_interned = 1,v_interned = 1   I0105 16:40:33.671581651 2400 parsing.cc:407] HTTP:1:HDR:CLI:拖车:47 72 70 63 2d 53 74 61 74 75 73'Grpc-Status'   I0105 16:40:33.671617014 2400 hpack_parser.cc:636]解码:“预告片:Grpc-Message”,elem_interned = 1 [1],k_interned = 1,v_interned = 1   I0105 16:40:33.671645555 2400 parsing.cc:407] HTTP:1:HDR:CLI:拖车:47 72 70 63 2d 4d 65 73 73 61 67 65'Grpc-Message'   I0105 16:40:33.671682689 2400 hpack_parser.cc:636]解码:“预告片:Grpc状态详细信息框”,elem_interned = 1 [1],k_interned = 1,v_interned = 1   I0105 16:40:33.671714771 2400 parsing.cc:407] HTTP:1:HDR:CLI:拖车:47 72 70 63 2d 53 74 61 74 75 73 2d 44 65 74 61 69 6c 73 2d 42 69 6e'Grpc-Status -细节-Bin'   I0105 16:40:33.674612891 2400 parsing.cc:661]解析traceing_metadata   I0105 16:40:33.674655858 2400 hpack_parser.cc:636]解码:“ grpc-status:0”,elem_interned = 1 [3],k_interned = 1,v_interned = 1   I0105 16:40:33.674685597 2400 parsing.cc:503] HTTP:1:TRL:CLI:grpc-status:30'0'   E0105 16:40:33.677045300 2396 fork_posix.cc:63]前叉支持仅与epoll1和轮询轮询策略兼容   I0105 16:40:33.677160556 2396 fork_posix.cc:68]当前其他线程正在调用gRPC,跳过fork()处理程序

0 个答案:

没有答案