2012-12-11 1 views
2

다음 자습서 : http://www.rabbitmq.com/tutorials/tutorial-three-python.html에서 다음 코드가 있습니다.Pika에서 "queue_declare"의 결과 개체에 대한 문서

result = channel.queue_declare(exclusive=True) 
    queue_name = result.method.queue 

피카에 대해 문서화 된 "결과"개체는 어디에 있습니까? 나는 이것으로부터 접근 할 수있는 모든 것을 알고 싶다.

+0

자바에서는 http://www.rabbitmq.com/releases/rabbitmq-java-client/v3.0.0/rabbitmq-java-client-javadoc-3.0.0/ 아마도 파이썬에서는 비슷하지만 그렇지 않습니다. 익숙한 – robthewolf

답변

2

어젯밤을 잊어 버렸습니다. 파이썬은 종종 "dir"함수를 사용하여 자체 문서화합니다. 이것을 파이썬 안에서 실행 한 다음 결과 개체에 "result.__class__"을 실행하면 이것이 Pika의 METHOD 개체라는 것을 알 수 있습니다.

>>> r 
<METHOD(['frame_type=1', 'channel_number=1', 'method=<Exchange.DeclareOk>'])> 
>>> r.__class__ 
<class 'pika.frame.Method'> 
>>> dir(r) 
['INDEX', 'NAME', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_marshal', 'channel_number', 'frame_type', 'marshal', 'method'] 

일부 인터넷 검색은이 문서에 저를 제공합니다 : https://pika.readthedocs.org/en/latest/frame.html#method

불행하게도

...

This class level documentation is not intended for use by those using Pika in their applications. This documentation is for those who are extending Pika or otherwise working on the driver itself. 

그래서는 RabbitMQ 웹 사이트에서이 구체적인 예는 새앙 토끼의 문서화되지 않은 기능을 사용하는 것으로 보인다. 결과적으로 내 응용 프로그램에서 고유 한 이름을 생성하게되었습니다.

관련 문제