【问题标题】:How do I send a gRPC request if there are no proto files?如果没有 proto 文件,如何发送 gRPC 请求?
【发布时间】:2022-06-24 11:24:17
【问题描述】:

我最近通过 mitmproxy 分析了 Zenly 应用程序,结果证明它可以在 gRPC 上运行,我能够提取请求的有效负载。我想用我自己的参数使用 Python 来模拟这个请求。比如有这样一个网址: https://secret.zenly.rpc.com/co.znly.users.services.sessions.SessionsService/SessionCreate,向其发送带有确认码的 SMS 的请求。调用该函数的payload如下:

{
"PhoneNumber": "secret",
  "device": {
    "appVersion": "4.63.14",
    "type": "ANDROID", 
    "osVersion": "12",
    "model": "secret",
    "acceptLanguages": "en-US;q=1.0",
    "coreVersion": "1.96.7",
    "appBundle": "app.zenly.locator"
  },
  "deviceOsUuid": "secret",
  "carrierInformations": {
    "networkOperatorCode": "25001",
    "networkOperatorName": "MTS",
    "networkCountryIso": "ru",
    "simOperatorCode": "25001",
    "simOperatorName": "MTS RUS",
    "simCountryIso": "ru"
  }
}

那么,如何以没有原始文件的序列化(?)格式正确地将所有这些发送到服务器?

附言 grpc_requests 和 grpcurl 不适合

【问题讨论】:

标签: python grpc


【解决方案1】:

您可以在这个问题中参考我的答案:How to create GRPC client directly from protobuf without compiling it into java code,它也应该在 python 中工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-08-24
    • 2020-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-28
    相关资源
    最近更新 更多