/
Salmon228
/
Blub
Обзор
Документация
Войти
/
Salmon228
/
Blub
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
gjapi_python-master/Documentation/reference.html
290 строк
17 KB
Salmon228
Первый коммит
02 дек 2025, 12:01
02 дек 2025, 12:01
b60c365
Код
Авторство
О чём код?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Reference — gjapi_python 1.0 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', VERSION: '1.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> <link rel="top" title="gjapi_python 1.0 documentation" href="index.html" /> <link rel="prev" title="Behavior" href="behavior.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="behavior.html" title="Behavior" accesskey="P">previous</a> |</li> <li><a href="index.html">gjapi_python 1.0 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-py_gjapi"> <span id="reference"></span><h1>Reference<a class="headerlink" href="#module-py_gjapi" title="Permalink to this headline">¶</a></h1> <dl class="class"> <dt id="py_gjapi.GameJoltTrophy"> <em class="property">class </em><tt class="descclassname">py_gjapi.</tt><tt class="descname">GameJoltTrophy</tt><big>(</big><em>username</em>, <em>user_token</em>, <em>game_id</em>, <em>private_key</em><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy" title="Permalink to this definition">¶</a></dt> <dd><p>The Class constructors. The class requires four essential parameters: user name, user token, game ID and private code. Check the API documentation on Game Jolt’s website to see what those parameters they are. In this code, I used the same names on the site. If you read it, you can understand what’s going on here.</p> <p>Note that <em>username</em> and <em>user token</em> can be changed later, but the game id and the private key must be defined first, as they won’t change.</p> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.addAchieved"> <tt class="descname">addAchieved</tt><big>(</big><em>trophy_id</em><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.addAchieved"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.addAchieved" title="Permalink to this definition">¶</a></dt> <dd><p>Sets a winning trophy for the user. If the parameters are valid, returns True. Otherwise, it returns False.</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.addScores"> <tt class="descname">addScores</tt><big>(</big><em>score</em>, <em>sort</em>, <em>table_id=None</em>, <em>extra_data=''</em>, <em>guest=False</em>, <em>guestname=''</em><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.addScores"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.addScores" title="Permalink to this definition">¶</a></dt> <dd><p>This method adds a score to the player or guest. <em>score</em> is a string value describing the score value. <em>sort</em> is the actual score value, a number value. But can be a string too. For <em>table_id</em>, check the fetchScores method. <em>extra_data</em> is a string value with any data you would like to store. It doesn’t appear on the site. If you want to store a score for a guest instead of the user, you: > set True to ‘guest’ parameter. > set a string value with the name of the guest on ‘guestname’</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.authenticateUser"> <tt class="descname">authenticateUser</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.authenticateUser"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.authenticateUser" title="Permalink to this definition">¶</a></dt> <dd><p>Authenticate a user defined in the object variable. The purpose of this method is to check if the user’s credential (name and token) are valid. Then, you’re safe to call the other methods Return a boolean type value.</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.changeUserToken"> <tt class="descname">changeUserToken</tt><big>(</big><em>user_token</em><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.changeUserToken"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.changeUserToken" title="Permalink to this definition">¶</a></dt> <dd><p>Changes the <em>user token</em> contained on the object Used for changing, setting and/or fixing authentications</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.changeUsername"> <tt class="descname">changeUsername</tt><big>(</big><em>username</em><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.changeUsername"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.changeUsername" title="Permalink to this definition">¶</a></dt> <dd><p>Changes the <em>username</em> contained on the object Used for changing, setting and/or fixing authentications</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.closeSession"> <tt class="descname">closeSession</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.closeSession"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.closeSession" title="Permalink to this definition">¶</a></dt> <dd><p>Closes the active section. Return a boolean value: True if a session closed with sucess, False otherwise.</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.fetchData"> <tt class="descname">fetchData</tt><big>(</big><em>key</em>, <em>user_info_only=False</em><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.fetchData"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.fetchData" title="Permalink to this definition">¶</a></dt> <dd><p>Return the data stored. The <em>key</em> variable is the identification value for the particular data you want to retrieve. If you want to return data only for the user stored in the object, the last argument is set to True. Returns a dictionary containing the data.</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.fetchScores"> <tt class="descname">fetchScores</tt><big>(</big><em>limit=10</em>, <em>table_id=None</em>, <em>user_info_only=False</em><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.fetchScores"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.fetchScores" title="Permalink to this definition">¶</a></dt> <dd><p>The <em>limit</em> argument is set to 10 by default, but can’t be more than 100. If you pass a higher number, the method will automatically set to the maximum size. <em>table_id</em> if for returning scores for a specific table. If no arguments are passed (None), it will return all the tables avaliable. If <em>user_info_only</em> is set to True, only scores for the player stored on the object will be returned.</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.fetchTrophy"> <tt class="descname">fetchTrophy</tt><big>(</big><em>achieved=None</em>, <em>trophy=None</em><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.fetchTrophy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.fetchTrophy" title="Permalink to this definition">¶</a></dt> <dd><p>The ‘trophy’ argument receives a list of one or more ID of trophies to be returned. It ignores the ‘achieved’ argument, so pass a ‘None’ value to it. where you pass the desired number between the braces, separating each trophy ID with commas. If ‘achieved’ is: > set to True, only the achieved trophies will be returned > set to False, only trophies that the user hasn’t achieved yet will be returned > set to None (no argument is passed), then all trophies will be retrieved</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.fetchUserInfo"> <tt class="descname">fetchUserInfo</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.fetchUserInfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.fetchUserInfo" title="Permalink to this definition">¶</a></dt> <dd><p>Fetches the infos of a user as a dictionary type. <strong>ATTENTION</strong>: it returns a dictionary type value with the key <em>users</em>, containing the user being fetched. Right now it only fetches the user stored in the object, but can retrive a list of users. This is not available now, will be implemented later.</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.getDataKeys"> <tt class="descname">getDataKeys</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.getDataKeys"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.getDataKeys" title="Permalink to this definition">¶</a></dt> <dd><p>Return all the keys avaliable. The return type is a dictionary object with a list of dictionaries. Each of those dictionaries contains a key with the name <strong>key</strong> and contain it’s value. Exemple: {‘keys’: [{‘key’: ‘1’}, {‘key’: ‘2’}, ...], ‘success’: ‘true’ }</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.openSession"> <tt class="descname">openSession</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.openSession"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.openSession" title="Permalink to this definition">¶</a></dt> <dd><p>Opens a game session for a particular user. Allows you to tell Game Jolt that a user is playing your game. You must ping the session (<strong>pingSession</strong> method) to keep it active and you must close it when you’re done with it. Note that you can only have one open session at a time. If you try to open a new session while one is running, the system will close out your current session before opening a new one. Return a boolean value: True if a session opened with sucess, False otherwise.</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.pingSession"> <tt class="descname">pingSession</tt><big>(</big><em>active=True</em><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.pingSession"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.pingSession" title="Permalink to this definition">¶</a></dt> <dd><p>Pings an open session to tell the system that it’s still active. If the session hasn’t been pinged within 120 seconds, the system will close the session and you will have to open another one. It’s recommended that you ping every 30 seconds or so to keep the system from cleaning up your session. You can also let the system know whether the player is in an “active” or “idle” state within your game through this call. To do this, you pass an argument to the <em>active</em> variable. If it is set to True, then the player state will be set to <strong>active</strong>. If False, it will be set to <strong>idle</strong>. Return a boolean value: True if a session pinged with sucess, False otherwise.</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.removeData"> <tt class="descname">removeData</tt><big>(</big><em>key</em><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.removeData"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.removeData" title="Permalink to this definition">¶</a></dt> <dd><p>Remove a data with the given key. <em>key</em> is the data identification. Return a boolean value: True if the data was removed with sucess, False otherwise.</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.scoreTable"> <tt class="descname">scoreTable</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.scoreTable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.scoreTable" title="Permalink to this definition">¶</a></dt> <dd><p>Returns the tables containing the high scores for the game.</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.setSignatureAndgetJSONResponse"> <tt class="descname">setSignatureAndgetJSONResponse</tt><big>(</big><em>URL</em><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.setSignatureAndgetJSONResponse"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.setSignatureAndgetJSONResponse" title="Permalink to this definition">¶</a></dt> <dd><p>Generates a signature from the url and returns the same address, with the signature added to it. All singatures are generated with md5, but can be modified below. This is the only function that generates the signature, so changing the encoding to SHA1 or other format will affect all URL requests.</p> </dd></dl> <dl class="method"> <dt id="py_gjapi.GameJoltTrophy.storeData"> <tt class="descname">storeData</tt><big>(</big><em>key</em>, <em>data</em>, <em>user_info_only=False</em><big>)</big><a class="reference internal" href="_modules/py_gjapi.html#GameJoltTrophy.storeData"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py_gjapi.GameJoltTrophy.storeData" title="Permalink to this definition">¶</a></dt> <dd><p>Set a data to be stored. The <em>key</em> argument is to define the identifier of the data. The <em>data</em> argument is the data itself, of string type. If you wish to pass the data only for this stored in the object, the last argument is set to True. Return a boolean value: True if the data was stored with sucess, False otherwise.</p> </dd></dl> </dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="behavior.html" title="previous chapter">Behavior</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/reference.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="behavior.html" title="Behavior" >previous</a> |</li> <li><a href="index.html">gjapi_python 1.0 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2013, Vinicius Castanheira. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>