-
Notifications
You must be signed in to change notification settings - Fork 58
More pythonic interface for CloudEvents #36
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.
This is a good. Main points:
- I would change the change the title of the PR and fix the formatting in the PR description.
- We can improve the comments added here.
@di Do you have any comments on this PR? We're going to work on this PR in the beginning of this week. |
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.
This looks like a good start. Generally I think a) there are some possibly unexpected changes in existing logic that I'm missing the motivation for and b) I don't think we need to include logic for emitting events, as this wasn't include in #26. If we think we want this, we should open a new issue to discuss first.
(Sorry, I wasn't able to finish my review last week so there maybe be some duplicate comments with other reviewers).
Re-request review after all comments are resolved. |
0e21146
to
47ab6d2
Compare
@di Can we get a review for this PR? |
CloudEvents is a more pythonic interface for using cloud events. It is powered by internal marshallers and cloud event base classes. It performs basic validation on fields, and cloud event type checking. Signed-off-by: Curtis Mason <[email protected]>
CloudEvents is a more pythonic interface for using cloud events. It is powered by internal marshallers and cloud event base classes. It performs basic validation on fields, and cloud event type checking. Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]>
CloudEvents is a more pythonic interface for using cloud events. It is powered by internal marshallers and cloud event base classes. It performs basic validation on fields, and cloud event type checking. Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]>
CloudEvents is a more pythonic interface for using cloud events. It is powered by internal marshallers and cloud event base classes. It performs basic validation on fields, and cloud event type checking. Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]>
* added changelog Signed-off-by: Curtis Mason <[email protected]> * Created CloudEvent class (#36) CloudEvents is a more pythonic interface for using cloud events. It is powered by internal marshallers and cloud event base classes. It performs basic validation on fields, and cloud event type checking. Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Fix tox configuration for CI (#46) Signed-off-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Implemented python properties in base.py (#41) * Added SetCloudEventVersion Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * began adding python properties Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * added pythonic properties to base class Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * began testing for getters/setters Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * added general setter tests Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * fixed spacing in base.py Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * added __eq__ to option and datacontentencoding property to v03 Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * lint fixes Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * testing extensions and old getters Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * removed versions v01 and v02 from test_data_encaps_refs.py Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * fixed inheritance issue in CloudEvent Signed-off-by: Curtis Mason <[email protected]> * added prefixed_headers dict to test Signed-off-by: Curtis Mason <[email protected]> * CHANGELOG adjustment Signed-off-by: Curtis Mason <[email protected]> * Update CHANGELOG.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Update CHANGELOG.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Update CHANGELOG.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Update CHANGELOG.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Removed irrelevant files from commit diff Signed-off-by: Curtis Mason <[email protected]> Co-authored-by: Dustin Ingram <[email protected]>
CloudEvents is a more pythonic interface for using cloud events. It is powered by internal marshallers and cloud event base classes. It performs basic validation on fields, and cloud event type checking. Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]>
* added changelog Signed-off-by: Curtis Mason <[email protected]> * Created CloudEvent class (cloudevents#36) CloudEvents is a more pythonic interface for using cloud events. It is powered by internal marshallers and cloud event base classes. It performs basic validation on fields, and cloud event type checking. Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Fix tox configuration for CI (cloudevents#46) Signed-off-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Implemented python properties in base.py (cloudevents#41) * Added SetCloudEventVersion Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * began adding python properties Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * added pythonic properties to base class Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * began testing for getters/setters Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * added general setter tests Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * fixed spacing in base.py Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * added __eq__ to option and datacontentencoding property to v03 Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * lint fixes Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * testing extensions and old getters Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * removed versions v01 and v02 from test_data_encaps_refs.py Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * fixed inheritance issue in CloudEvent Signed-off-by: Curtis Mason <[email protected]> * added prefixed_headers dict to test Signed-off-by: Curtis Mason <[email protected]> * CHANGELOG adjustment Signed-off-by: Curtis Mason <[email protected]> * Update CHANGELOG.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Update CHANGELOG.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Update CHANGELOG.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Update CHANGELOG.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Removed irrelevant files from commit diff Signed-off-by: Curtis Mason <[email protected]> Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]>
* Created CloudEvent class (#36) CloudEvents is a more pythonic interface for using cloud events. It is powered by internal marshallers and cloud event base classes. It performs basic validation on fields, and cloud event type checking. Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * Implemented python properties in base.py (#41) * Added SetCloudEventVersion Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * began adding python properties Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * added pythonic properties to base class Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * began testing for getters/setters Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * added general setter tests Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * fixed spacing in base.py Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * added __eq__ to option and datacontentencoding property to v03 Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * lint fixes Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * testing extensions and old getters Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * removed versions v01 and v02 from test_data_encaps_refs.py Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * fixed inheritance issue in CloudEvent Signed-off-by: Curtis Mason <[email protected]> * added prefixed_headers dict to test Signed-off-by: Curtis Mason <[email protected]> * Http structured cloudevents (#47) * Moved fields out of base & structured support base._ce_required_fields and base._ce_optional_fields were moved into event classes v03 and v1. http_events.CloudEvent class now looks for fieldnames in either headers or data, and can automatically determine whether this is a binary or structured event. Signed-off-by: Curtis Mason <[email protected]> * testing structured Signed-off-by: Curtis Mason <[email protected]> * added tests for structured events Signed-off-by: Curtis Mason <[email protected]> * Added test valid structured cloudevents Signed-off-by: Curtis Mason <[email protected]> * Created default headers arg in CloudEvent Signed-off-by: Curtis Mason <[email protected]> * Added http_events.py sample code Signed-off-by: Curtis Mason <[email protected]> * removed ../python-event-requests Signed-off-by: Curtis Mason <[email protected]> * README.md nit Signed-off-by: Curtis Mason <[email protected]> * client.py nit Signed-off-by: Curtis Mason <[email protected]> * comment nits Signed-off-by: Curtis Mason <[email protected]> * created __getitem__ in CloudEvent Signed-off-by: Curtis Mason <[email protected]> * sample nits Signed-off-by: Curtis Mason <[email protected]> * fixed structured empty data issue Signed-off-by: Curtis Mason <[email protected]> * Added CloudEvent to README Signed-off-by: Curtis Mason <[email protected]> * added http_msg to CloudEvent Signed-off-by: Curtis Mason <[email protected]> * implemented ToRequest in CloudEvent Signed-off-by: Curtis Mason <[email protected]> * testing more specversions Signed-off-by: Curtis Mason <[email protected]> * Added sample code to README.md Signed-off-by: Curtis Mason <[email protected]> * modified sample code Signed-off-by: Curtis Mason <[email protected]> * added datavalidation to changelog Signed-off-by: Curtis Mason <[email protected]> * updated README Signed-off-by: Curtis Mason <[email protected]> * README adjustment Signed-off-by: Curtis Mason <[email protected]> * ruler 80 adjustment on http_events Signed-off-by: Curtis Mason <[email protected]> * style and renamed ToRequest to to_request Signed-off-by: Curtis Mason <[email protected]> * lint fix Signed-off-by: Curtis Mason <[email protected]> * fixed self.binary typo Signed-off-by: Curtis Mason <[email protected]> * CHANGELOG adjustment Signed-off-by: Curtis Mason <[email protected]> * rollback CHANGELOG Signed-off-by: Curtis Mason <[email protected]> * Added documentation to to_request Signed-off-by: Curtis Mason <[email protected]> * README.md adjustment Signed-off-by: Curtis Mason <[email protected]> * renamed event_handler to event_version Signed-off-by: Curtis Mason <[email protected]> * inlined field_name_modifier Signed-off-by: Curtis Mason <[email protected]> * renamed test body data Signed-off-by: Curtis Mason <[email protected]> * removed unnecessary headers from test Signed-off-by: Curtis Mason <[email protected]> * removed field_name_modifier and fixed e.g. in client.py Signed-off-by: Curtis Mason <[email protected]> * pylint fix Signed-off-by: Curtis Mason <[email protected]> * Update types and handle data_base64 structured. (#34) * Update types and handle data_base64 structured. - Add sane defaults for encoding - Unfortunately, defaults for structured and binary need to be *different* - Push types through interfaces - Make it easy to call 'ToRequest' using Marshaller defaults - Add tests for above Signed-off-by: Evan Anderson <[email protected]> * Fix lint warnings due to changes to W503/W504 See https://gitlab.com/pycqa/flake8/-/issues/466 for details. Signed-off-by: Evan Anderson <[email protected]> * Adopt di's suggestions. Signed-off-by: Evan Anderson <[email protected]> * Fix lint. Signed-off-by: Evan Anderson <[email protected]> * Move types to another package. Signed-off-by: Evan Anderson <[email protected]> * Adjust CloudEvent class in http_events.py to support binary data as well as JSON. Signed-off-by: Evan Anderson <[email protected]> * Apply suggested changes by MacrBoissonneault Signed-off-by: Evan Anderson <[email protected]> * Fix samples as well. Signed-off-by: Evan Anderson <[email protected]> * Fix lint. Apparently, we can complain about formating issues, but a human has to fix them. Signed-off-by: Evan Anderson <[email protected]> * Add test for binary encoding of messages. Fix usability of binary detection in MarshalJSON to support memoryview. Signed-off-by: Evan Anderson <[email protected]> * Fix errors noticed by cumason123 Signed-off-by: Evan Anderson <[email protected]> * Changelog version deprecation (#48) * added changelog Signed-off-by: Curtis Mason <[email protected]> * Created CloudEvent class (#36) CloudEvents is a more pythonic interface for using cloud events. It is powered by internal marshallers and cloud event base classes. It performs basic validation on fields, and cloud event type checking. Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Fix tox configuration for CI (#46) Signed-off-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Implemented python properties in base.py (#41) * Added SetCloudEventVersion Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * began adding python properties Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * added pythonic properties to base class Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * began testing for getters/setters Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * added general setter tests Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * fixed spacing in base.py Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * added __eq__ to option and datacontentencoding property to v03 Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * lint fixes Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * testing extensions and old getters Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * removed versions v01 and v02 from test_data_encaps_refs.py Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Dustin Ingram <[email protected]> * fixed inheritance issue in CloudEvent Signed-off-by: Curtis Mason <[email protected]> * added prefixed_headers dict to test Signed-off-by: Curtis Mason <[email protected]> * CHANGELOG adjustment Signed-off-by: Curtis Mason <[email protected]> * Update CHANGELOG.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Update CHANGELOG.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Update CHANGELOG.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Update CHANGELOG.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Removed irrelevant files from commit diff Signed-off-by: Curtis Mason <[email protected]> Co-authored-by: Dustin Ingram <[email protected]> * Black formatter (#51) * black and isort added to precommit Signed-off-by: Curtis Mason <[email protected]> * main renaming Signed-off-by: Curtis Mason <[email protected]> * fixed tox Signed-off-by: Curtis Mason <[email protected]> * linting in tox rename Signed-off-by: Curtis Mason <[email protected]> * fixed tox trailing space Signed-off-by: Curtis Mason <[email protected]> * added reformat tox env Signed-off-by: Curtis Mason <[email protected]> * Reformatting files Signed-off-by: Curtis Mason <[email protected]> * reformatted more files Signed-off-by: Curtis Mason <[email protected]> * documented tox in README Signed-off-by: Curtis Mason <[email protected]> * removed -rc flag Signed-off-by: Curtis Mason <[email protected]> * README and http-cloudevents sample code adjustments to reflect new CloudEvent (#56) * README and http-cloudevents CloudEvent adjustments README no longer shows how to use base event classes to create events. Removed this because users shouldn't be forced to interact with the marshaller class. Additionally, CloudEvent is a simpler interface therefore we are encouraging the CloudEvent class usage. http-cloudevents now has more example usage for the getitem overload. Similarly README shows how to use getitem overload. Signed-off-by: Curtis Mason <[email protected]> * lint reformat Signed-off-by: Curtis Mason <[email protected]> * resolved nits Signed-off-by: Curtis Mason <[email protected]> * lint fix Signed-off-by: Curtis Mason <[email protected]> * renamed /mycontext to url Signed-off-by: Curtis Mason <[email protected]> * renamed here linlk to in the samples directory Signed-off-by: Curtis Mason <[email protected]> * Separated http methods (#60) * instantiated http path Signed-off-by: Curtis Mason <[email protected]> * moved from_http from CloudEvent to http Signed-off-by: Curtis Mason <[email protected]> * Moved to_http out of CloudEvent Signed-off-by: Curtis Mason <[email protected]> * moved http library into event.py Signed-off-by: Curtis Mason <[email protected]> * testing printable cloudevent Signed-off-by: Curtis Mason <[email protected]> * Adjusted README Signed-off-by: Curtis Mason <[email protected]> * Created EventClass Signed-off-by: Curtis Mason <[email protected]> * reformatted event.py Signed-off-by: Curtis Mason <[email protected]> * from_json definition Signed-off-by: Curtis Mason <[email protected]> * server print changes Signed-off-by: Curtis Mason <[email protected]> * Specversion toggling (#57) * cloudevent now switches specversion types Signed-off-by: Curtis Mason <[email protected]> * removed duplicate marshall instance Signed-off-by: Curtis Mason <[email protected]> * resolved grant requests Signed-off-by: Curtis Mason <[email protected]> * converters now can check headers for fields Signed-off-by: Curtis Mason <[email protected]> * removed print statement Signed-off-by: Curtis Mason <[email protected]> * Fixed marshallers looking at headers for specversion Signed-off-by: Curtis Mason <[email protected]> * lint fixes Signed-off-by: Curtis Mason <[email protected]> * is_binary static method and structured isinstance rework Signed-off-by: Curtis Mason <[email protected]> * testing for is_binary and is_structured Signed-off-by: Curtis Mason <[email protected]> * Image sample code (#65) * added image example Signed-off-by: Curtis Mason <[email protected]> * moved size into headers Signed-off-by: Curtis Mason <[email protected]> * lint fix Signed-off-by: Curtis Mason <[email protected]> * renamed sample code Signed-off-by: Curtis Mason <[email protected]> * added test to http-image-cloudevents sample Signed-off-by: Curtis Mason <[email protected]> * removed unnecessary function Signed-off-by: Curtis Mason <[email protected]> * Added testing for http-image-cloudevents Signed-off-by: Curtis Mason <[email protected]> * Data marshall arg fix and better image in sample Fixed bug where data_marshaller and data_unmarshaller wasn't being passed into positional arguments. Also used cloudevents logo for the image in http-image-cloudevents Signed-off-by: Curtis Mason <[email protected]> * adjusted http-image-cloudevents samples Signed-off-by: Curtis Mason <[email protected]> * reformat and README changes Signed-off-by: Curtis Mason <[email protected]> * io bytes casting in data_unmarshaller Signed-off-by: Curtis Mason <[email protected]> * lint fix Signed-off-by: Curtis Mason <[email protected]> * removed unusued imports in http-image samples Signed-off-by: Curtis Mason <[email protected]> * removed samples/http-cloudevents/tmp.png Signed-off-by: Curtis Mason <[email protected]> * Nits Signed-off-by: Curtis Mason <[email protected]> * Implemented to_json and from_json (#72) * added test_to_json test Signed-off-by: Curtis Mason <[email protected]> * implemented to_json with tests Signed-off-by: Curtis Mason <[email protected]> * from_json and to_json tests Signed-off-by: Curtis Mason <[email protected]> * Tests for to_json being able to talk to from_json Signed-off-by: Curtis Mason <[email protected]> * lint fix Signed-off-by: Curtis Mason <[email protected]> * added documentation for to_json and from_json Signed-off-by: Curtis Mason <[email protected]> * lint fix Signed-off-by: Curtis Mason <[email protected]> * lint fix Signed-off-by: Curtis Mason <[email protected]> * Fixed top level extensions bug (#71) * Fixed top level extensions bug Signed-off-by: Curtis Mason <[email protected]> * lint fix Signed-off-by: Curtis Mason <[email protected]> * fixed name bug in test_event_extensions Signed-off-by: Curtis Mason <[email protected]> * fixed broken links in README.md (#75) Signed-off-by: Curtis Mason <[email protected]> * Fixed marshaller documentation typo's in http (#76) * Fixed marshaller documentation in http directory Signed-off-by: Curtis Mason <[email protected]> * adjusted marshaller documentation Signed-off-by: Curtis Mason <[email protected]> * None data fix (#78) * fixed none data issue Signed-off-by: Curtis Mason <[email protected]> * added none data test for marshalling Signed-off-by: Curtis Mason <[email protected]> * lint fix Signed-off-by: Curtis Mason <[email protected]> * Samples image test server (#79) * fixed none data issue Signed-off-by: Curtis Mason <[email protected]> * added none data test for marshalling Signed-off-by: Curtis Mason <[email protected]> * lint fix Signed-off-by: Curtis Mason <[email protected]> * added http server test in image sample Signed-off-by: Curtis Mason <[email protected]> * Removed print statements from test Signed-off-by: Curtis Mason <[email protected]> * removed requests from test Signed-off-by: Curtis Mason <[email protected]> * Top level http (#83) * Modularized http and made http a top level module Modularized the http directory by separating related functions into different scripts. Also removed EventClass and kept a singular CloudEvent. Finally, CloudEvent.__repr__ was refactored such that it doesn't depend on external methods. Signed-off-by: Curtis Mason <[email protected]> * renamed requests.py to http_methods Signed-off-by: Curtis Mason <[email protected]> * lint fixes Signed-off-by: Curtis Mason <[email protected]> * http-json-cloudevents testing (#80) * Added tests to http-json-cloudevents Signed-off-by: Curtis Mason <[email protected]> * removed outdated python-requests sample code Signed-off-by: Curtis Mason <[email protected]> * lint fix Signed-off-by: Curtis Mason <[email protected]> * Added flask to requirements Signed-off-by: Curtis Mason <[email protected]> * lint fix Signed-off-by: Curtis Mason <[email protected]> * docs: add README badge (#85) Signed-off-by: Grant Timmerman <[email protected]> * added pypi-release rule (#87) * added pypi-release rule Signed-off-by: Curtis Mason <[email protected]> * added RELEASING.md Signed-off-by: Curtis Mason <[email protected]> * Adjusted RELEASING.md Signed-off-by: Curtis Mason <[email protected]> * Update .github/workflows/pypi-release.yml Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * workflow pypi name changed Signed-off-by: Curtis Mason <[email protected]> * Update RELEASING.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Update RELEASING.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Update RELEASING.md Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * removed some pbr stuff Signed-off-by: Curtis Mason <[email protected]> * Removed all pbr stuff Signed-off-by: Curtis Mason <[email protected]> * README nits Signed-off-by: Curtis Mason <[email protected]> * RELEASING adjustment in README Signed-off-by: Curtis Mason <[email protected]> * author update in setup.cfg Signed-off-by: Curtis Mason <[email protected]> * removed setup.cfg Signed-off-by: Curtis Mason <[email protected]> * Update setup.py Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * lint fix Signed-off-by: Curtis Mason <[email protected]> Co-authored-by: Dustin Ingram <[email protected]> * pypi-release git tags automation (#88) * added pypi_packaging Signed-off-by: Curtis Mason <[email protected]> * reverted pypi-release Signed-off-by: Curtis Mason <[email protected]> * added pypi_package workflow Signed-off-by: Curtis Mason <[email protected]> * added gitpython dependency Signed-off-by: Curtis Mason <[email protected]> * added git import in createTag function Signed-off-by: Curtis Mason <[email protected]> * Updated RELEASING.md and implemented pypi_config in pypi_packaging.pg Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Fixed some docs Signed-off-by: Curtis Mason <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * Update .github/workflows/pypi-release.yml Co-authored-by: Dustin Ingram <[email protected]> Signed-off-by: Curtis Mason <[email protected]> * added __version__ Signed-off-by: Curtis Mason <[email protected]> * lint change Signed-off-by: Curtis Mason <[email protected]> * reinstalling cloudevents in workflow Signed-off-by: Curtis Mason <[email protected]> * added cloudevents to publish.txt Signed-off-by: Curtis Mason <[email protected]> * removed old release_doc Signed-off-by: Curtis Mason <[email protected]> Co-authored-by: Dustin Ingram <[email protected]> Co-authored-by: Evan Anderson <[email protected]> Co-authored-by: Dustin Ingram <[email protected]> Co-authored-by: Grant Timmerman <[email protected]>
Link to issue this resolves
v1 converter doesn't check the required attributes #33
Consider a more Pythonic API #26
What I did
I made a class which internalizes the HTTP marshallers, verifies required fields, and currently supports HTTP post requests to notify event listeners on other endpoints.
How I did it
I made an Event class with an internal v1.Event, and an internal HTTPMarshaller
How to verify it
I will make tests in a different PR, but you can run the sample code as shown below:
pip3 install ./sdk-python
cd sdk-python/samples/python-event-requests/
python3 sample-server.py
In a different terminal but still in the same samples/python-event-requests folder:
python3 cloudevent_to_request.py http://localhost:3000/event
If the sample code worked you'll see the same event printed in both terminals
Outlined a more Pythonic Event handler