Debian Codegraph @

docs/modules/parameters.rst

raw
1 Connection Parameters
2 =====================
3 To maintain flexibility in how you specify the connection information required for your applications to properly connect to RabbitMQ, pika implements two classes for encapsulating the information, :class:`~pika.connection.ConnectionParameters` and :class:`~pika.connection.URLParameters`.
4
5 ConnectionParameters
6 --------------------
7 The classic object for specifying all of the connection parameters required to connect to RabbitMQ, :class:`~pika.connection.ConnectionParameters` provides attributes for tweaking every possible connection option.
8
9 Example::
10
11 import pika
12
13 # Set the connection parameters to connect to rabbit-server1 on port 5672
14 # on the / virtual host using the username "guest" and password "guest"
15 credentials = pika.PlainCredentials('guest', 'guest')
16 parameters = pika.ConnectionParameters('rabbit-server1',
17 5672,
18 '/',
19 credentials)
20
21 .. autoclass:: pika.connection.ConnectionParameters
22 :members:
23 :inherited-members:
24 :member-order: bysource
25
26 URLParameters
27 -------------
28 The :class:`~pika.connection.URLParameters` class allows you to pass in an AMQP URL when creating the object and supports the host, port, virtual host, ssl, username and password in the base URL and other options are passed in via query parameters.
29
30 Example::
31
32 import pika
33
34 # Set the connection parameters to connect to rabbit-server1 on port 5672
35 # on the / virtual host using the username "guest" and password "guest"
36 parameters = pika.URLParameters('amqp://guest:guest@rabbit-server1:5672/%2F')
37
38 .. autoclass:: pika.connection.URLParameters
39 :members:
40 :inherited-members:
41 :member-order: bysource
42