Skip to content

Commit 15889cc

Browse files
committed
adds syntax highlighting
1 parent 0d7eb75 commit 15889cc

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

README.rst

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ Initializing
4141
~~~~~~~~~~~~
4242

4343
Import the package at the top of any file where you will use it. At the very least you will need the
44-
``OpenTok`` class. Then initialize an OpenTok instance with your own API Key and API Secret.::
44+
``OpenTok`` class. Then initialize an OpenTok instance with your own API Key and API Secret.
4545

46+
.. code:: python
4647
from opentok import OpenTok
4748
4849
opentok = OpenTok(api_key, api_secret)
@@ -53,8 +54,9 @@ Creating Sessions
5354
The create an OpenTok Session, use the ``opentok.create_session()`` method. There are two optional
5455
keyword parameters for this method: ``location`` which can be set to a string containing an IP
5556
address, and ``p2p`` which is a boolean. This method returns a ``Session`` object. Its
56-
``session_id`` attribute is useful when saving to a persistent store (e.g. database).::
57+
``session_id`` attribute is useful when saving to a persistent store (e.g. database).
5758

59+
.. code:: python
5860
# Just a plain Session
5961
session = opentok.create_session()
6062
# A p2p Session
@@ -71,8 +73,9 @@ Generating Tokens
7173
Once a Session is created, you can start generating Tokens for clients to use when connecting to it.
7274
You can generate a token either by calling the ``opentok.generate_token(session_id)`` method or by
7375
calling the ``session.generate_token()`` method on a ``Session`` instance after creating it. There
74-
is a set of optional keyword parameters: ``role``, ``expire_time``, and ``data``.::
76+
is a set of optional keyword parameters: ``role``, ``expire_time``, and ``data``.
7577

78+
.. code:: python
7679
# Generate a Token from just a session_id (fetched from a database)
7780
token = opentok.generate_token(session_id)
7881
# Generate a Token by calling the method on the Session (returned from create_session)
@@ -90,29 +93,33 @@ Working with Archives
9093
You can start the recording of an OpenTok Session using the ``opentok.start_archive(session_id)``
9194
method. This method takes an optional keyword argument ``name`` to assign a name to the archive.
9295
This method will return an ``Archive`` instance. Note that you can only start an Archive on
93-
a Session that has clients connection.::
96+
a Session that has clients connection.
9497

98+
.. code:: python
9599
archive = opentok.start_archive(session_id, name=u'Important Presentation')
96100
97101
# Store this archive_id in the database
98102
archive_id = archive.id
99103
100104
You can stop the recording of a started Archive using the ``opentok.stop_archive(archive_id)``
101-
method. You can also do this using the ``archive.stop()`` method of an ``Archive`` instance.::
105+
method. You can also do this using the ``archive.stop()`` method of an ``Archive`` instance.
102106

107+
.. code:: python
103108
# Stop an Archive from an archive_id (fetched from database)
104109
opentok.stop_archive(archive_id)
105110
# Stop an Archive from an instance (returned from opentok.start_archive)
106111
archive.stop()
107112
108113
To get an ``Archive`` instance (and all the information about it) from an archive ID, use the
109-
``opentok.get_archive(archive_id)`` method.::
114+
``opentok.get_archive(archive_id)`` method.
110115

116+
.. code:: python
111117
archive = opentok.get_archive(archive_id)
112118
113119
To delete an Archive, you can call the ``opentok.delete_archive(archive_id)`` method or the
114-
``archive.delete()`` method of an ``Archive`` instance.::
120+
``archive.delete()`` method of an ``Archive`` instance.
115121

122+
.. code:: python
116123
# Delete an Archive from an archive ID (fetched from database)
117124
opentok.delete_archive(archive_id)
118125
# Delete an Archive from an Archive instance (returned from opentok.start_archive or
@@ -122,8 +129,9 @@ To delete an Archive, you can call the ``opentok.delete_archive(archive_id)`` me
122129
You can also get a list of all the Archives you've created (up to 1000) with your API Key. This is
123130
done using the ``opentok.list_archives()`` method. There are two optional keyword parameters:
124131
``count`` and ``offset``; they can help you paginate through the results. This method returns an
125-
instance of the ``ArchiveList`` class.::
132+
instance of the ``ArchiveList`` class.
126133

134+
.. code:: python
127135
archive_list = opentok.list_archive()
128136
129137
# Get a specific Archive from the list

0 commit comments

Comments
 (0)