Skip to content

Instantly share code, notes, and snippets.

@robbmanes
Created May 10, 2023 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robbmanes/f1d04c0e946de7fb7ede35377394e743 to your computer and use it in GitHub Desktop.
Save robbmanes/f1d04c0e946de7fb7ede35377394e743 to your computer and use it in GitHub Desktop.
Get HLL CRCON VIP ID's and export them to CSV
import csv
import requests
import sys
RCON_URL='http://mycoolrcon.example'
RCON_USERNAME='admin'
RCON_PASSWORD='password'
CSV_FILE='vips.csv'
def main():
session = requests.session()
response = session.get(RCON_URL + '/api/login', json={'username': RCON_USERNAME, 'password': RCON_PASSWORD})
data = response.json()
if data['failed']:
print('Failure logging in!')
print(data)
return
response = session.get(RCON_URL + '/api/get_vip_ids')
data = response.json()
if data['failed']:
print('Failed to get VIP ID\'s!')
print(data)
return
with open(CSV_FILE, 'a', newline='') as f:
writer = csv.writer(f, dialect='excel')
writer.writerow(['steam_id_64', 'name', 'vip_expiration'])
for entry in data['result']:
print(entry)
writer.writerow([entry['steam_id_64'], entry['name'], entry['vip_expiration']])
if __name__ == '__main__':
sys.exit(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment