Website IconRankGun

Python Package

Our python package is designed to allow you to interact with the RankGun API via python.

Getting Started

Installation

You can download the package using pip:

pip install rankgun 

Simple Example

At the beginning of each RankGun application is the client. The client represents your workspace, to intializae a client import it from the Rankgun package:

from rankgun.main import Client
from httpx import HTTPStatusError
 
client = Client(wid="xyz", token="xyz")
 
response = client.promote(5138182593)
print(response.updateTime)

The client requires an API token & Workspace Id.

Error Handling

The RankGun Module also handles documented errors.

All of the methods raise an exception when a documented error occurs, when an undocumented error occurs a HttpError will be raised. Here is an example of us using exception handling:

from rankgun.main import Client
from rankgun.exceptions import WorkspaceMustBeActivatedError 
 
client = Client(wid="xyz", token="xyz")
 
try:
    client.promote(user_id=1012243713)
except HTTPStatusError as e:
    print(e.response.json())

Code Reference

The full reference for our rankgun package.

Client

The class behind everything.

ParameterDescriptionType
api_tokenA Workspace's API tokenString
workspace_idA Workspace's IDString

Code Sample:

from rankgun import Client
 
client = Client("123456789", "api_key_here")

Methods


promote

Promotes a user one rank higher in the group.

ParameterDescriptionType
user_idRoblox User IDInt

Code Sample:

client.promote(1234567)

demote

Demotes a user one rank lower in the group.

ParameterDescriptionType
user_idRoblox User IDInt

Code Sample:

client.demote(1234567)

setRank

Sets the rank of a user to a specific level.

ParameterDescriptionType
user_idRoblox User IDInt
rankTarget Roblox RankInt

Code Sample:

client.setRank(1234567, 4)

Contributions

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

You can contribute in many ways:

Types of Contributions

Report Bugs

Report bugs at https://github.com/rankgun/python/issues

If you are reporting a bug, please include:

  • Your operating system name and version.
  • Any details about your local setup that might be helpful in troubleshooting.
  • Detailed steps to reproduce the bug.

Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with "bug" and "help wanted" is open to whoever wants to implement a fix for it.

Implement Features

Look through the GitHub issues for features. Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it.

Write Documentation

rankgun could always use more documentation, whether as part of the official docs, in docstrings, or even on the web in blog posts, articles, and such.

Submit Feedback

The best way to send feedback is to file an issue at https://github.com/rankgun/python/issues.

If you are proposing a new feature:

  • Explain in detail how it would work.
  • Keep the scope as narrow as possible, to make it easier to implement.
  • Remember that this is a volunteer-driven project, and that contributions are welcome :)

On this page