Skip to main content

This library provides access to all cftools api methods. It is a kind of wrapper for all methods.

Project description

pycftools

This library provides access to all cftools api methods. It is a kind of wrapper for all methods.

https://developer.cftools.cloud/documentation/data-api

Installation

pip istall pycftools

Dependencies

Basic usage:

import pycftools

cfapi = pycftools.CfToolsApi(app_id='',
                             app_secret='', game_identifier='',
                             ip='', game_port='',
                             server_id='',
                             server_banlist_id='')

# Before working with methods, you need to get a token
# The library itself will add the token to the session headers
# All you need to do is create an instance of the class with all the parameters.
# And run the registration method.
if cfapi.cftools_api_check_register():
    print('OK')
    cfapi.cftools_api_get_grants()
else:
    print('Something not OK')

Constructor arguments

Class CfToolsApi used to access various cftools api methods.
The main use, getting access to api.
The ability to automate some processes, and getting access to the application from outside.

:param app_id: Application Id from https://developer.cftools.cloud/applications
:type app_id: str
:param app_secret: Application secret from https://developer.cftools.cloud/applications
:type app_secret: str
:param game_identifier: Game_identifier is needed to create server id.
:type game_identifier: str
:param ip: Ipv4 is needed to create server id.
:type ip: str
:param game_port: Game_port is needed to create server id.
:type game_port: str
:param server_id: Server_api_id this is the global server identifier and it can be found in the server API settings.
:type server_id: str
:param server_banlist_id: Server_banlist_id is global banlist identifier
 It can be found in ban-manager https://app.cftools.cloud/ban-manager - see for Banlist ID.
:type server_banlist_id: str
:param auth_token_filename: Auth_token_filename this is the filename var for auth token file.
:type auth_token_filename: str
:param pycftools_debug: This is the variable for enabling debug outputs from the program.
:type pycftools_debug: bool
:param timestamp_delta: This is the time offset delta when the token in the file needs to be updated. 
 By default, the value is set to half a day - 43200. UNIXTIMESTAMP
:type timestamp_delta: int

Methods

The library provides all the methods from the cftools documentation. Request parameters are completely identical to those presented in the documentation.

All methods of the class return response objects, this is done for the convenience of further control.

You need to work with them as with ordinary responses to requests. json(), text, status_code, etc...

If you don't know how to work with response objects. Read the documentation for the requests module.

Authentication

cfapi = pycftools.CfToolsApi(--->...<---)
# Before working with methods, you need to get a token
# The library itself will add the token to the session headers
# All you need to do is create an instance of the class with all the parameters.
# And run the registration method.
cfapi.cftools_api_check_register()
# After receiving the token, you get access to all methods

Grant process and access permissions

[GET] cftools_api_get_grants() 

Game-Server

# The library itself creates the serverID (sha1 -> hexdigest) from the game id, ipv4, gameport

[GET] cftools_api_get_server_details() 

Server

[GET] cftools_api_get_server_info()
[GET] cftools_api_get_server_statistics()
[GET] cftools_api_get_server_list()
[POST] cftools_api_server_kick(gs_id, reason) # gamesession_id, reason. -> str
[POST] cftools_api_server_private_message(gs_id, content) # gamesession_id, content. -> str
[POST] cftools_api_server_public_message(content) # content -> str
[POST] cftools_api_server_row_rcon_command(command) # command -> str
[POST] cftools_api_server_teleport(gs_id, coords) # gamesession_id -> str, coords -> [X,Y] -> list
[POST] cftools_api_server_spawn(gs_id, obj_name, quantity) # gamesession_id, obj_name -> str, quantity -> int

# SEE CFTOOLS DOCS TO MORE INFORMATION ABOUT PARAMS
[GET] cftools_api_server_queue_priority_list(cftools_id, comment)
[POST] cftools_api_server_queue_priority_entry(cftools_id, expires_at, comment)
[DELETE] cftools_api_server_queue_priority_delete_entry(cftools_id)

[GET] cftools_api_server_whitelist(cftools_id, comment)
[POST] cftools_api_server_whitelist_entry(cftools_id, expires_at, comment)
[DELETE] cftools_api_server_whitelist_delete_entry(cftools_id)

[GET] cftools_api_server_leaderboard(stat, order, limit)
[GET] cftools_api_server_player_stats(cftools_id)

Banlist

[GET] cftools_api_server_banlist() 
[POST] cftools_api_server_ban(frmt, identifier, expires_at, reason)
[DELETE] cftools_api_server_unban(ban_id)

Users

[GET] cftools_api_server_lookup(identifier)

If u needed to close session

cfapi.close()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycftools-0.2.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

pycftools-0.2.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file pycftools-0.2.0.tar.gz.

File metadata

  • Download URL: pycftools-0.2.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for pycftools-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0ca46ae4f528fe603df14c67fec9c0b905d046351a9c31667af146428f070c1f
MD5 3a61a8b868d321f901d994a4da4418c3
BLAKE2b-256 76e07f0e7589b14c65ed0216209154dd860a92637fbd3f7db6de7adc9d500ec1

See more details on using hashes here.

File details

Details for the file pycftools-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pycftools-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for pycftools-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f36d6763d78e258ff0d5aa14de91d262a1d6d231ad6044c0ed8b2dd60c8f6129
MD5 bd50cf772593b984e0324e2da5aaaa1d
BLAKE2b-256 9c7fefe2af4f39623b2587d1b1f39adef65180f0b76135b2a806f20224fd6f53

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page