https://prefect.io logo
#prefect-community
Title
# prefect-community
t

Thomas La Piana

07/22/2020, 5:29 AM
I have my graphql URL behind traefik and am using auth with it. I'd like to be able to register a flow by just passing the auth headers to the register() method the same way that I can pass it to the graphql queries. Should I make a PR for this or is there another option to register the flow? Is the serialize + graphql option I've seen the correct solution here?
j

josh

07/22/2020, 11:20 AM
Hi @Thomas La Piana I think this would be a suitable enhancement! 🙂 Currently you could accomplish by using some of the code the register client command currently uses and adjusting the
client.graphql
call to attach your headers https://github.com/PrefectHQ/prefect/blob/master/src/prefect/client/client.py#L570
t

Thomas La Piana

07/22/2020, 2:56 PM
@josh it looks like the best way is to just pass the an optional headers dict to each of the graphql calls in the register method right? just want to make sure I'm not missing some extra bit of complexity because it seems like an easy fix to me to knock out otherwise
j

josh

07/22/2020, 3:08 PM
@Thomas La Piana Yep that would be it!
t

Thomas La Piana

07/22/2020, 3:25 PM
awesome, i'll get on that
j

josh

07/22/2020, 4:28 PM
@Thomas La Piana apologies, I actually might have steered you the wrong way. Instead of adding this kwarg to client functions for this specific use case you can already accomplish it with something like this:
Copy code
c = Client()
c.attach_headers({my: auth})

c.register(my_flow, ...)
t

Thomas La Piana

07/23/2020, 1:56 AM
ohhhh interesting, that is actually exactly what I'm looking for! i looked at the source and somehow missed that I could do that too. Thanks!