* 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 <cumason@google.com>
* renamed requests.py to http_methods
Signed-off-by: Curtis Mason <cumason@google.com>
* lint fixes
Signed-off-by: Curtis Mason <cumason@google.com>
* 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 <cumason@google.com>
* lint reformat
Signed-off-by: Curtis Mason <cumason@google.com>
* resolved nits
Signed-off-by: Curtis Mason <cumason@google.com>
* lint fix
Signed-off-by: Curtis Mason <cumason@google.com>
* renamed /mycontext to url
Signed-off-by: Curtis Mason <cumason@google.com>
* renamed here linlk to in the samples directory
Signed-off-by: Curtis Mason <cumason@google.com>
* 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 <evan.k.anderson@gmail.com>
* Fix lint warnings due to changes to W503/W504
See https://gitlab.com/pycqa/flake8/-/issues/466 for details.
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
* Adopt di's suggestions.
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
* Fix lint.
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
* Move types to another package.
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
* Adjust CloudEvent class in http_events.py to support binary data as well as JSON.
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
* Apply suggested changes by MacrBoissonneault
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
* Fix samples as well.
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
* Fix lint. Apparently, we can complain about formating issues, but a human has to fix them.
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
* Add test for binary encoding of messages.
Fix usability of binary detection in MarshalJSON to support memoryview.
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
* Fix errors noticed by cumason123
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
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 <cumason@google.com>
Signed-off-by: Dustin Ingram <di@users.noreply.github.com>