# RTCSessionDescriptionInit

Session descriptions as plain data, to set on a connection or to exchange with the remote peer.

### *class* webrtc.models.rtc_session_description_init.RTCSessionDescriptionInit(type, sdp='')

The type and the SDP of a session description, as plain data.

[`webrtc.RTCPeerConnection.create_offer()`](../interfaces/rtc_peer_connection.md#webrtc.interfaces.rtc_peer_connection.RTCPeerConnection.create_offer) and [`webrtc.RTCPeerConnection.create_answer()`](../interfaces/rtc_peer_connection.md#webrtc.interfaces.rtc_peer_connection.RTCPeerConnection.create_answer) return it, and
the methods that set a description take it. `from_json()` creates it from a message of the remote peer.
See [MDN: RTCSessionDescription/RTCSessionDescription](https://developer.mozilla.org/en-US/docs/Web/API/RTCSessionDescription/RTCSessionDescription).

* **Parameters:**
  * **type** ([`webrtc.RTCSdpType`](../enums.md#webrtc.enums.RTCSdpType)) – The type of the description, or its value (like `'offer'`).
  * **sdp** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str), optional) – The SDP of the description, empty by default.
* **Raises:**
  * [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If the type isn’t a member of [`webrtc.RTCSdpType`](../enums.md#webrtc.enums.RTCSdpType).
  * [**TypeError**](https://docs.python.org/3/builtins/exceptions.html#TypeError) – If the SDP is [`None`](https://docs.python.org/3/builtins/constants.html#None).

### *class* webrtc.models.rtc_session_description_init.RTCLocalSessionDescriptionInit(type=None, sdp='')

A description for [`webrtc.RTCPeerConnection.set_local_description()`](../interfaces/rtc_peer_connection.md#webrtc.interfaces.rtc_peer_connection.RTCPeerConnection.set_local_description), whose type may be left out.

Without an SDP, the connection creates and sets the description itself. It uses the given type, or else the
offer or answer that its signaling state calls for. See [MDN: RTCPeerConnection/setLocalDescription](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setLocalDescription).

* **Parameters:**
  * **type** ([`webrtc.RTCSdpType`](../enums.md#webrtc.enums.RTCSdpType), optional) – The type of the description, or its value (like `'offer'`).
    Required when an SDP is given.
  * **sdp** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str), optional) – The SDP of the description, empty by default.
* **Raises:**
  * [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If the type isn’t a member of [`webrtc.RTCSdpType`](../enums.md#webrtc.enums.RTCSdpType).
  * [**TypeError**](https://docs.python.org/3/builtins/exceptions.html#TypeError) – If the SDP is [`None`](https://docs.python.org/3/builtins/constants.html#None).
