Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to include custom headers in RedpandaSchemaRegistry's requests #398

Closed
wants to merge 1 commit into from

Conversation

Psykopear
Copy link
Contributor

@Psykopear Psykopear commented Feb 8, 2024

Adds an option to include headers in each request to redpanda's schema registry.

@@ -90,14 +90,17 @@ def deserializer(self) -> SchemaDeserializer[MaybeStrBytes, AvroMessage]:
class RedpandaSchemaRegistry:
"""Redpanda's schema registry client."""

def __init__(self, base_url: str = "http://localhost:8081"):
def __init__(self, base_url: str = "http://localhost:8081", headers=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we maybe make this a **request_kwargs and delegate to the request docs? Only a matter of time before someone asks for the cert or verify or cookies args too.

https://requests.readthedocs.io/en/latest/api/#requests.request

Copy link
Contributor Author

@Psykopear Psykopear Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking more about it, given some recent discussions, it seems people expect redpanda's schema registry to just work by using confluent's client and changing the url. The compatibility is not explicitly stated in the docs, but appears to be given for granted, and trying it, it does work.

So my idea would be to unify both schema registry classes under a single one, that uses confluent's library and is compatible with anything that's compatible with that (including redpanda).

We still need to keep a way for users to specify if they want plain avro (de)serialization, or confluent's bytes+avro one, so I'll probably have to add an option to .serializer and .deserializer function. I'm opening a PR with the proposed changes so we can discuss that better.

edit see #399 I'm going to convert this PR to draft and delete it if the other one goes through

@Psykopear
Copy link
Contributor Author

Fixed with #399

@Psykopear Psykopear closed this Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants