Skip to content

Commit

Permalink
update and tweaks docs and sphinx conf
Browse files Browse the repository at this point in the history
  • Loading branch information
rossengeorgiev committed Jul 10, 2019
1 parent 94c5e5a commit e39c049
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 51 deletions.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
from steam import __version__, __author__

project = u'steam'
copyright = u'2016, %s' % __author__
copyright = u'2019, %s' % __author__
author = __author__

# The version info for the project you're documenting, acts as replacement for
Expand Down Expand Up @@ -295,7 +295,7 @@
intersphinx_mapping = {
'python': ('https://docs.python.org/3.6', None),
'gevent': ('http://www.gevent.org', None),
'requests': ('http://docs.python-requests.org/en/master', None),
'requests': ('https://2.python-requests.org/en/master/', None),
}

# AUTODOC
Expand Down
75 changes: 36 additions & 39 deletions steam/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ def reconnect(self, maxdelay=30, retry=0):
The delay is reset upon a successful login.
:param maxdelay: maximum delay in seconds before connect (0-120s)
:type maxdelay: :class:`int`
:type maxdelay: :class:`int`
:param retry: see :meth:`.CMClient.connect`
:type retry: :class:`int`
:type retry: :class:`int`
:return: successful connection
:rtype: :class:`bool`
"""
Expand All @@ -236,28 +236,28 @@ def reconnect(self, maxdelay=30, retry=0):
def wait_msg(self, event, timeout=None, raises=None):
"""Wait for a message, similiar to :meth:`.wait_event`
:param event: :class:`.EMsg' or job id
:param event: event id
:type event: :class:`.EMsg` or job id
:param timeout: seconds to wait before timeout
:type timeout: :class:`int`
:param raises: On timeout when ``False` returns :class:`None`, else raise :class:`gevent.Timeout`
:type raises: :class:`bool`
:type timeout: :class:`int`
:param raises: On timeout when ``False`` returns :class:`None`, else raise :class:`gevent.Timeout`
:type raises: :class:`bool`
:return: returns a message or :class:`None`
:rtype: :class:`None`, or `proto message`
:raises: ``gevent.Timeout``
:raises: :class:`gevent.Timeout`
"""
resp = self.wait_event(event, timeout, raises)

if resp is not None:
return resp[0]

def send(self, message, body_params=None):
""".. versionchanged:: 0.8.4
Send a message to CM
"""Send a message to CM
:param message: a message instance
:type message: :class:`.Msg`, :class:`.MsgProto`
:type message: :class:`.Msg`, :class:`.MsgProto`
:param body_params: a dict with params to the body (only :class:`.MsgProto`)
:type body_params: dict
:type body_params: dict
"""
if not self.connected:
self._LOG.debug("Trying to send message when not connected. (discarded)")
Expand All @@ -268,16 +268,15 @@ def send(self, message, body_params=None):
CMClient.send(self, message)

def send_job(self, message, body_params=None):
""".. versionchanged:: 0.8.4
Send a message as a job
"""Send a message as a job
.. note::
Not all messages are jobs, you'll have to find out which are which
:param message: a message instance
:type message: :class:`.Msg`, :class:`.MsgProto`
:type message: :class:`.Msg`, :class:`.MsgProto`
:param body_params: a dict with params to the body (only :class:`.MsgProto`)
:type body_params: dict
:type body_params: dict
:return: ``jobid`` event identifier
:rtype: :class:`str`
Expand Down Expand Up @@ -305,23 +304,22 @@ def send_job(self, message, body_params=None):
return "job_%d" % jobid

def send_job_and_wait(self, message, body_params=None, timeout=None, raises=False):
""".. versionchanged:: 0.8.4
Send a message as a job and wait for the response.
"""Send a message as a job and wait for the response.
.. note::
Not all messages are jobs, you'll have to find out which are which
:param message: a message instance
:type message: :class:`.Msg`, :class:`.MsgProto`
:type message: :class:`.Msg`, :class:`.MsgProto`
:param body_params: a dict with params to the body (only :class:`.MsgProto`)
:type body_params: dict
:type body_params: dict
:param timeout: (optional) seconds to wait
:type timeout: :class:`int`
:param raises: (optional) On timeout if ``False`` return ``None``, else raise ``gevent.Timeout``
:type raises: :class:`bool`
:type timeout: :class:`int`
:param raises: (optional) On timeout if ``False`` return ``None``, else raise :class:`gevent.Timeout`
:type raises: :class:`bool`
:return: response proto message
:rtype: :class:`.Msg`, :class:`.MsgProto`
:raises: ``gevent.Timeout``
:raises: :class:`gevent.Timeout`
"""
job_id = self.send_job(message, body_params)
response = self.wait_event(job_id, timeout, raises=raises)
Expand All @@ -330,22 +328,21 @@ def send_job_and_wait(self, message, body_params=None, timeout=None, raises=Fals
return response[0].body

def send_message_and_wait(self, message, response_emsg, body_params=None, timeout=None, raises=False):
""".. versionchanged:: 0.8.4
Send a message to CM and wait for a defined answer.
"""Send a message to CM and wait for a defined answer.
:param message: a message instance
:type message: :class:`.Msg`, :class:`.MsgProto`
:type message: :class:`.Msg`, :class:`.MsgProto`
:param response_emsg: emsg to wait for
:type response_emsg: :class:`.EMsg`,:class:`int`
:type response_emsg: :class:`.EMsg`,:class:`int`
:param body_params: a dict with params to the body (only :class:`.MsgProto`)
:type body_params: dict
:type body_params: dict
:param timeout: (optional) seconds to wait
:type timeout: :class:`int`
:param raises: (optional) On timeout if ``False`` return ``None``, else raise ``gevent.Timeout``
:type raises: :class:`bool`
:type timeout: :class:`int`
:param raises: (optional) On timeout if ``False`` return ``None``, else raise :class:`gevent.Timeout`
:type raises: :class:`bool`
:return: response proto message
:rtype: :class:`.Msg`, :class:`.MsgProto`
:raises: ``gevent.Timeout``
:raises: :class:`gevent.Timeout`
"""
self.send(message, body_params)
response = self.wait_event(response_emsg, timeout, raises=raises)
Expand All @@ -368,7 +365,7 @@ def get_sentry(self, username):
returns ``None`` if :attr:`credential_location` is not set, or file is not found/inaccessible
:param username: username
:type username: :class:`str`
:type username: :class:`str`
:return: sentry file contents, or ``None``
:rtype: :class:`bytes`, :class:`None`
"""
Expand Down Expand Up @@ -449,17 +446,17 @@ def login(self, username, password='', login_key=None, auth_code=None, two_facto
"""Login as a specific user
:param username: username
:type username: :class:`str`
:type username: :class:`str`
:param password: password
:type password: :class:`str`
:type password: :class:`str`
:param login_key: login key, instead of password
:type login_key: :class:`str`
:type login_key: :class:`str`
:param auth_code: email authentication code
:type auth_code: :class:`str`
:type auth_code: :class:`str`
:param two_factor_code: 2FA authentication code
:type two_factor_code: :class:`str`
:type two_factor_code: :class:`str`
:param login_id: number used for identifying logon session
:type login_id: :class:`int`
:type login_id: :class:`int`
:return: logon result, see `CMsgClientLogonResponse.eresult <https://github.com/ValvePython/steam/blob/513c68ca081dc9409df932ad86c66100164380a6/protobufs/steammessages_clientserver.proto#L95-L118>`_
:rtype: :class:`.EResult`
Expand Down
18 changes: 9 additions & 9 deletions steam/client/builtins/leaderboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ def get_leaderboard(self, app_id, name):
Find a leaderboard
:param app_id: application id
:type app_id: :class:`int`
:type app_id: :class:`int`
:param name: leaderboard name
:type name: :class:`str`
:type name: :class:`str`
:return: leaderboard instance
:rtype: :class:`SteamLeaderboard`
:rtype: :class:`.SteamLeaderboard`
:raises: :class:`LookupError` on message timeout or error
"""
message = MsgProto(EMsg.ClientLBSFindOrCreateLB)
Expand Down Expand Up @@ -103,13 +103,13 @@ def get_entries(self, start=0, end=0, data_request=None, steam_ids=None):
"""Get leaderboard entries.
:param start: start entry, not index (e.g. rank 1 is ``start=1``)
:type start: :class:`int`
:type start: :class:`int`
:param end: end entry, not index (e.g. only one entry then ``start=1,end=1``)
:type end: :class:`int`
:type end: :class:`int`
:param data_request: data being requested
:type data_request: :class:`steam.enums.common.ELeaderboardDataRequest`
:param steam_ids: list of steam ids when using :prop:`.ELeaderboardDataRequest.Users`
:type steamids: :class:`list`
:type data_request: :class:`steam.enums.common.ELeaderboardDataRequest`
:param steam_ids: list of steam ids when using :attr:`.ELeaderboardDataRequest.Users`
:type steamids: :class:`list`
:return: a list of entries, see ``CMsgClientLBSGetLBEntriesResponse``
:rtype: :class:`list`
:raises: :class:`LookupError` on message timeout or error
Expand Down Expand Up @@ -167,7 +167,7 @@ def get_iter(self, times, seconds, chunk_size=2000):
See :class:`steam.util.throttle.ConstantRateLimit` for ``times`` and ``seconds`` parameters.
:param chunk_size: number of entries per request
:type chunk_size: :class:`int`
:type chunk_size: :class:`int`
:returns: generator object
:rtype: :class:`generator`
Expand Down
2 changes: 1 addition & 1 deletion steam/webauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Keep in mind if you are trying to write robust code.
.. note::
If you are using :class:`.SteamClient` take a look at :meth:`.get_web_session()`
If you are using :class:`.SteamClient` take a look at :meth:`.SteamClient.get_web_session()`
.. note::
If you need to authenticate as a mobile device for things like trading confirmations
Expand Down

0 comments on commit e39c049

Please sign in to comment.