Skip to content

Instantly share code, notes, and snippets.

@bryanjhv
Created May 19, 2020 21:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bryanjhv/03f39ca5b9c7666d472d485e5b650414 to your computer and use it in GitHub Desktop.
Save bryanjhv/03f39ca5b9c7666d472d485e5b650414 to your computer and use it in GitHub Desktop.
Delete JetBrains IDE Settings Sync (JBA Account) data
#!/usr/bin/env python3
# USAGE:
# 1. Download https://account.jetbrains.com/profile-details/JetBrainsPersonalData.xlsx
# 2. Open with Excel, go to Account sheet (default) and copy "Account ID" value (token)
# 3. Go to your IDE's folder and copy the "name" property from "product-info.json"
# 4. Run:
# export TOKEN=... # step 2
# export PRODUCT=... # step 3
# python3 jbadel.py
from sys import exit
from os import getenv
from http.client import HTTPSConnection
TOKEN = getenv('TOKEN')
PRODUCT = getenv('PRODUCT')
if not (TOKEN and PRODUCT):
print('ERROR: Missing $TOKEN or $PRODUCT.')
exit(1)
conn = HTTPSConnection('cloudconfig.jetbrains.com')
# TODO: Check if "PUT .del" is useful
for path in ['.del', 'files.7z', 'updates.7z', 'api']:
conn.request(
'DELETE',
f'/cloudconfig/files/{PRODUCT}/{path}',
None,
{'user-agent': 'Java/11.0.6', 'authorization': f'JBA-Token {TOKEN}'},
)
res = conn.getresponse()
res.read() # Don't remove, needs to be here
if res.status == 204:
print(f'INFO: Delete {path} succeeded.')
else:
print(f'ERROR: Delete {path} failed.')
exit(1)
print(f'INFO: Successfully deleted {PRODUCT} JBA settings.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment