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

basic_publish allows str type #6

Closed
baodrate opened this issue Jan 16, 2022 · 0 comments · Fixed by #7
Closed

basic_publish allows str type #6

baodrate opened this issue Jan 16, 2022 · 0 comments · Fixed by #7

Comments

@baodrate
Copy link
Owner

basic_publish's body parameter, e.g.:

https://github.com/qubidt/pika-stubs/blob/a0e7b336e6b2f9a9bcde347725b9348871096080/pika-stubs/adapters/blocking_connection.pyi#L184-L191

or

https://github.com/qubidt/pika-stubs/blob/a0e7b336e6b2f9a9bcde347725b9348871096080/pika-stubs/channel.pyi#L110-L117

allows a str argument, per pika code:

   def basic_publish(self,
                     exchange,
                     routing_key,
                     body,
                     properties=None,
                     mandatory=False):
       """Publish to the channel with the given exchange, routing key and body.
       For more information on basic_publish and what the parameters do, see:

       http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.publish

       :param str exchange: The exchange to publish to
       :param str routing_key: The routing key to bind on
       :param bytes body: The message body
       :param pika.spec.BasicProperties properties: Basic.properties
       :param bool mandatory: The mandatory flag

       """
       self._raise_if_not_open()
       if isinstance(body, unicode_type):
           body = body.encode('utf-8')
       properties = properties or spec.BasicProperties()
       ...

Copied from hahow/pika-stubs/issues/8

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 a pull request may close this issue.

1 participant