-
Notifications
You must be signed in to change notification settings - Fork 915
Add support for HTTP Basic Auth #440
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff, some minor comments.
Also missing an integration test.
Now with integration tests! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, good stuff!
@edenhill mind giving this another pass |
@@ -94,9 +152,15 @@ def _send_request(self, url, method='GET', body=None, headers={}): | |||
_headers.update(headers) | |||
|
|||
response = self._session.request(method, url, headers=_headers, json=body) | |||
|
|||
# Returned by Jetty not SR so the payload is not json encoded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to wrap the json parsing in a try-block for all 4xx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any comment on this? Still seems like a valid concern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry missed this one. I like this idea I did something similar in the CCloud CLI as well.
ca83f84
to
5414e04
Compare
ea4a682
to
92b5c19
Compare
@edenhill, mind giving this another go. I have fast-forwarded to rebase the PR on master and addressed all of your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, buddy!
Would be nice with an avro example, with auth support (maybe commented out), in examples/
@@ -94,9 +152,15 @@ def _send_request(self, url, method='GET', body=None, headers={}): | |||
_headers.update(headers) | |||
|
|||
response = self._session.request(method, url, headers=_headers, json=body) | |||
|
|||
# Returned by Jetty not SR so the payload is not json encoded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any comment on this? Still seems like a valid concern
@edenhill, hopefully this cleans up the rest. |
Deletes the specified subject and its associated compatibility level if registered. | ||
It is recommended to use this API only when a topic needs to be recycled or in development environments | ||
|
||
@:param: subject: subject name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this doxygen style, make sure the docs are generated correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It follows the conventions within the rest of the file. Would you like me to correct all of them or just this one?
It is recommended to use this API only when a topic needs to be recycled or in development environments | ||
|
||
@:param: subject: subject name | ||
@:returns: version (int) - version of the schema deleted under this subject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is an '@rtype' for specifying the return type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
examples/serialization/__init__.py
Outdated
@@ -0,0 +1 @@ | |||
__import__('pkg_resources').declare_namespace(__name__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid conflicts between confluent_kafka.avro and examples.avro
c4e374f
to
107911d
Compare
@@ -0,0 +1,180 @@ | |||
#!/usr/bin/env python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the examples/seriali../avro.. path may be overdoing it (but it is fine)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having faced this again, I really think it should be in examples/ with the other examples, I don't see a reason for the separation
@@ -0,0 +1,180 @@ | |||
#!/usr/bin/env python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having faced this again, I really think it should be in examples/ with the other examples, I don't see a reason for the separation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smaller nits, almost there!
examples/avro-cli.py
Outdated
""") | ||
|
||
|
||
# User stores the deserialized user Avro record. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be doc strings
examples/avro-cli.py
Outdated
self.favorite_number = favorite_number | ||
self.favorite_color = favorite_color | ||
|
||
# The Avro Python library does not support code generation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docstring
examples/avro-cli.py
Outdated
record.favorite_number = int(input("Enter favorite number: ")) | ||
record.favorite_color = input("Enter favorite color: ") | ||
|
||
producer.produce(topic=topic, partition=0, value=record.to_dict(), callback=on_delivery) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest not specifying the partition, is atypical, and not needed with subscribe()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack, leftover from usage of assign
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could use this opportunity to demonstrate how you would do externalized custom partitioning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the python client does not support pluggable partitioners, and it doesn't seem relevant for show-casing avro.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant how you could still use a custom partitioner externally (i.e. explicitly set the partition with the result of some hashing function). You are right though that is out of place here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one small change with brackets, then good to go!
LGTM! |
Might want to consider fixing the history of recent commit-review-ping-pong commits. |
35e7eb1
to
6c81cbe
Compare
I am still getting the below error. please confirm if this has been fixed and can you share working exmaple for the same. run the example avro producer script from https://github.com/confluentinc/confluent-kafka-python/blob/master/README.md having edited for my broker, schema registry and topic name. error stack is : |
I am still getting the error. Can you please share the working code for the same? error stack is : |
No description provided.