Hi Cihad,

Here is an example of metadata (aka. HTTP Headers) usage in gRPC Python:
https://github.com/grpc/grpc/tree/master/examples/python/metadata.

If you just started to use gRPC Python, I would suggest to read our guide:
https://grpc.io/docs/languages/python/
For question about certain API usage, you may found API reference useful:
https://grpc.github.io/grpc/python/index.html


On Thu, May 20, 2021 at 8:14 AM Cihad Ceviz <cihad.ce...@gmail.com> wrote:

> Hello, I'm a newbie in the world of grpc and coding. If my question is
> ridiculous, I apologize in advance.
>
> Question: There is a token that we have defined in X. And I have to decide
> whether to run transactions using this token. I can receive the incoming
> request correctly, but I don't know how to access the headers part of this
> request. Is it possible to reach the variable that I define the request by
> typing ".headers" as in the RESTFUL API architecture? What should I do? Can
> you help me?
>
> Thank You, Good Work
>
> If I need to share my code block:
>
> ` def UDTForegroundApp(self, request, context):
>         apiRequest = {
>             "Token": I need to put the token in the request here
>               ....
>               ....
>               ....
>               ....
>         }
>
>         headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
>         requests.post('http://
> *****/api/auth/save-application', data=json.dumps(apiRequest), 
> headers=headers)
>
> return generatedProtos.application_pb2.DTForegroundAppResponse(ret_complete = 
> services.config.foreground_application_ret_complete) `
>
> --
> You received this message because you are subscribed to the Google Groups "
> grpc.io" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to grpc-io+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/018258c9-8062-456e-a327-1e1b0eac8070n%40googlegroups.com
> <https://groups.google.com/d/msgid/grpc-io/018258c9-8062-456e-a327-1e1b0eac8070n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAMC1%3DjcCoFdrzQ%2B41KzDPRcdyh%3DT5GJuvC6k1cGdzxLD7zOTbg%40mail.gmail.com.

Reply via email to