Skip to content

Commit

Permalink
Trying to pass flake8
Browse files Browse the repository at this point in the history
I think it's a bit weird to write this way (bug = me^2 XD)
  • Loading branch information
MemoryShadow committed Aug 30, 2022
1 parent 3639323 commit 12c00b9
Showing 1 changed file with 33 additions and 32 deletions.
65 changes: 33 additions & 32 deletions minecraft/authentication.py
Expand Up @@ -287,11 +287,11 @@ class Microsoft_AuthenticationToken(object):

jwt_Token = ''

def __init__(self, access_token = None):
def __init__(self, access_token=None):
self.access_token = access_token
self.profile = Profile()

def GetoAuth20(self, code: str='') -> object:
def GetoAuth20(self, code='') -> object:
if code == '':
print(
"Please copy this link to your browser to open:"
Expand Down Expand Up @@ -327,18 +327,18 @@ def GetoAuth20(self, code: str='') -> object:

def GetXBL(self, access_token: str) -> object:
XBL = requests.post(self.XBL_URL,
json =
{
"Properties": {
"AuthMethod": "RPS",
"SiteName": "user.auth.xboxlive.com",
"RpsTicket": "{}".format(access_token)
json=
{
"Properties": {
"AuthMethod": "RPS",
"SiteName": "user.auth.xboxlive.com",
"RpsTicket": "{}".format(access_token)
},
"RelyingParty": "http://auth.xboxlive.com",
"TokenType": "JWT"
},
"RelyingParty": "http://auth.xboxlive.com",
"TokenType": "JWT"
},
headers = HEADERS,
timeout = 15
headers=HEADERS,
timeout=15
)
return {
"Token": json.loads(XBL.text)['Token'],
Expand All @@ -347,17 +347,17 @@ def GetXBL(self, access_token: str) -> object:

def GetXSTS(self, access_token: str) -> object:
XBL = requests.post(self.XSTS_URL,
json =
{
"Properties": {
"SandboxId": "RETAIL",
"UserTokens": ["{}".format(access_token)]
json=
{
"Properties": {
"SandboxId": "RETAIL",
"UserTokens": ["{}".format(access_token)]
},
"RelyingParty": "rp://api.minecraftservices.com/",
"TokenType": "JWT"
},
"RelyingParty": "rp://api.minecraftservices.com/",
"TokenType": "JWT"
},
headers = HEADERS,
timeout = 15
headers=HEADERS,
timeout=15
)
return {
"Token": json.loads(XBL.text)['Token'],
Expand All @@ -368,9 +368,9 @@ def GetXBOX(self, access_token: str, uhs: str) -> str:
mat_jwt = requests.post(
self.LOGIN_WITH_XBOX_URL,
json=
{
"identityToken": "XBL3.0 x={};{}".format(uhs, access_token)
},
{
"identityToken": "XBL3.0 x={};{}".format(uhs, access_token)
},
headers=HEADERS, timeout=15
)
self.access_token = json.loads(mat_jwt.text)['access_token']
Expand Down Expand Up @@ -530,16 +530,17 @@ def PersistenceLogoin_w(self):
print(PersistenceDir)
"Save access_token and oauth20_refresh_token"
with open(
"{}/{}".format(PersistenceDir,self.username),
"{}/{}".format(PersistenceDir, self.username),
mode='w',
encoding='utf-8'
) as file_obj:
file_obj.write(
'{{"access_token": "{}","oauth20_refresh_token": "{}"}}'.
format(
self.access_token,
self.oauth20_refresh_token
)
'{{"{}": "{}","{}": "{}"}}'.format(
'access_token',
self.access_token,
'oauth20_refresh_token',
self.oauth20_refresh_token
)
)
file_obj.close()
return True
Expand Down

0 comments on commit 12c00b9

Please sign in to comment.