1
0
mirror of https://github.com/creyD/asiimov.git synced 2026-06-12 00:52:23 +02:00

Unified Codestyle

This commit is contained in:
2020-03-03 20:28:11 +01:00
parent cd4db7d13f
commit 7a087ba45d

View File

@@ -32,14 +32,14 @@ FLOAT_SERVER = 'https://api.csgofloat.com/?url='
# HELPER # HELPER
def validate_steam_login(params): def validate_steam_login(params):
steam_login_url_base = "https://steamcommunity.com/openid/login" steam_login_url_base = 'https://steamcommunity.com/openid/login'
new_params = params.copy() new_params = params.copy()
new_params["openid.mode"] = "check_authentication" new_params['openid.mode'] = 'check_authentication'
r = requests.post(steam_login_url_base, data=new_params) r = requests.post(steam_login_url_base, data=new_params)
if "is_valid:true" in r.text: if 'is_valid:true' in r.text:
return True return True
return False return False
@@ -104,9 +104,9 @@ def search(request, filter):
def signup(request): def signup(request):
steam_openid_url = 'https://steamcommunity.com/openid/login' steam_openid_url = 'https://steamcommunity.com/openid/login'
u = { u = {
'openid.ns': "http://specs.openid.net/auth/2.0", 'openid.ns': 'http://specs.openid.net/auth/2.0',
'openid.identity': "http://specs.openid.net/auth/2.0/identifier_select", 'openid.identity': 'http://specs.openid.net/auth/2.0/identifier_select',
'openid.claimed_id': "http://specs.openid.net/auth/2.0/identifier_select", 'openid.claimed_id': 'http://specs.openid.net/auth/2.0/identifier_select',
'openid.mode': 'checkid_setup', 'openid.mode': 'checkid_setup',
'openid.return_to': 'http://' + request.META['HTTP_HOST'] + '/signup_confirm', 'openid.return_to': 'http://' + request.META['HTTP_HOST'] + '/signup_confirm',
'openid.realm': 'http://' + request.META['HTTP_HOST'] + '' 'openid.realm': 'http://' + request.META['HTTP_HOST'] + ''
@@ -222,7 +222,7 @@ def profile_inventory_update(request, steamID):
try: try:
inventory_object = json.load(urllib.request.urlopen(QUERY)) inventory_object = json.load(urllib.request.urlopen(QUERY))
except urllib.URLError: except urllib.URLError:
print("Error accessing Steam") print('Error accessing Steam')
if 'success' in inventory_object: if 'success' in inventory_object:
for item in inventory_object['assets']: for item in inventory_object['assets']:
if item['instanceid'] == 0: if item['instanceid'] == 0:
@@ -234,10 +234,10 @@ def profile_inventory_update(request, steamID):
) )
gamer.inventory_2.add(item_class[0]) gamer.inventory_2.add(item_class[0])
else: else:
print("Getting item: " + str(item)) print('Getting item: ' + str(item))
instance_data = getInstanceData(inventory_object, item['instanceid']) # TODO Fix Bug Here instance_data = getInstanceData(inventory_object, item['instanceid']) # TODO Fix Bug Here
link = FLOAT_SERVER + instance_data['actions'][0]['link'].replace("%owner_steamid%", link = FLOAT_SERVER + instance_data['actions'][0]['link'].replace('%owner_steamid%',
str(steamID)).replace("%assetid%", str(item['instanceid'])) str(steamID)).replace('%assetid%', str(item['instanceid']))
try: try:
item_infos = json.load(urllib.request.urlopen(link)) item_infos = json.load(urllib.request.urlopen(link))
@@ -268,9 +268,9 @@ def profile_inventory_update(request, steamID):
) )
gamer.inventory.add(new_item) gamer.inventory.add(new_item)
except: except:
print("Error Adding Item") print('Error Adding Item')
else: else:
print("STEAM API CALL NOT SUCCESSFULL!") print('STEAM API CALL NOT SUCCESSFULL!')
return redirect(profile_inventory, steamID=steamID) return redirect(profile_inventory, steamID=steamID)