Create a connection pool. ``If max_connections`` is set, then this object raises :py:class:`~redis.exceptions.ConnectionError` when the pool's limit is reached. By default, TCP connections are created unless ``connection_class`` is specified. Use class:`.UnixDomainSocketConnect
| 2802 | |
| 2803 | |
| 2804 | class ConnectionPool(MaintNotificationsAbstractConnectionPool, ConnectionPoolInterface): |
| 2805 | """ |
| 2806 | Create a connection pool. ``If max_connections`` is set, then this |
| 2807 | object raises :py:class:`~redis.exceptions.ConnectionError` when the pool's |
| 2808 | limit is reached. |
| 2809 | |
| 2810 | By default, TCP connections are created unless ``connection_class`` |
| 2811 | is specified. Use class:`.UnixDomainSocketConnection` for |
| 2812 | unix sockets. |
| 2813 | :py:class:`~redis.SSLConnection` can be used for SSL enabled connections. |
| 2814 | |
| 2815 | If ``maint_notifications_config`` is provided, the connection pool will support |
| 2816 | maintenance notifications. |
| 2817 | Maintenance notifications are supported only with RESP3. |
| 2818 | If the ``maint_notifications_config`` is not provided but the ``protocol`` is 3, |
| 2819 | the maintenance notifications will be enabled by default. |
| 2820 | |
| 2821 | Any additional keyword arguments are passed to the constructor of |
| 2822 | ``connection_class``. |
| 2823 | """ |
| 2824 | |
| 2825 | @classmethod |
| 2826 | def from_url(cls: Type[_CP], url: str, **kwargs) -> _CP: |
| 2827 | """ |
| 2828 | Return a connection pool configured from the given URL. |
| 2829 | |
| 2830 | For example:: |
| 2831 | |
| 2832 | redis://[[username]:[password]]@localhost:6379/0 |
| 2833 | rediss://[[username]:[password]]@localhost:6379/0 |
| 2834 | unix://[username@]/path/to/socket.sock?db=0[&password=password] |
| 2835 | |
| 2836 | Three URL schemes are supported: |
| 2837 | |
| 2838 | - `redis://` creates a TCP socket connection. See more at: |
| 2839 | <https://www.iana.org/assignments/uri-schemes/prov/redis> |
| 2840 | - `rediss://` creates a SSL wrapped TCP socket connection. See more at: |
| 2841 | <https://www.iana.org/assignments/uri-schemes/prov/rediss> |
| 2842 | - ``unix://``: creates a Unix Domain Socket connection. |
| 2843 | |
| 2844 | The username, password, hostname, path and all querystring values |
| 2845 | are passed through urllib.parse.unquote in order to replace any |
| 2846 | percent-encoded values with their corresponding characters. |
| 2847 | |
| 2848 | There are several ways to specify a database number. The first value |
| 2849 | found will be used: |
| 2850 | |
| 2851 | 1. A ``db`` querystring option, e.g. redis://localhost?db=0 |
| 2852 | 2. If using the redis:// or rediss:// schemes, the path argument |
| 2853 | of the url, e.g. redis://localhost/0 |
| 2854 | 3. A ``db`` keyword argument to this function. |
| 2855 | |
| 2856 | If none of these options are specified, the default db=0 is used. |
| 2857 | |
| 2858 | All querystring options are cast to their appropriate Python types. |
| 2859 | Boolean arguments can be specified with string values "True"/"False" |
| 2860 | or "Yes"/"No". Values that cannot be properly cast cause a |
| 2861 | ``ValueError`` to be raised. Once parsed, the querystring arguments |
no outgoing calls