[api] Fix GQL API requests

These need to use a different User-Agent for some reason.
This commit is contained in:
derrod 2021-12-29 21:14:59 +01:00
parent 2adc0b1a3e
commit 99c97032b4

View file

@ -235,6 +235,7 @@ class EPCAPI:
def store_get_uplay_codes(self):
user_id = self.user.get('account_id')
r = self.session.post(f'https://{self._store_gql_host}/graphql',
headers={'user-agent': self._store_user_agent},
json=dict(query=uplay_codes_query,
variables=dict(accountId=user_id)))
r.raise_for_status()
@ -243,6 +244,7 @@ class EPCAPI:
def store_claim_uplay_code(self, uplay_id, game_id):
user_id = self.user.get('account_id')
r = self.session.post(f'https://{self._store_gql_host}/graphql',
headers={'user-agent': self._store_user_agent},
json=dict(query=uplay_claim_query,
variables=dict(accountId=user_id,
uplayAccountId=uplay_id,
@ -253,6 +255,7 @@ class EPCAPI:
def store_redeem_uplay_codes(self, uplay_id):
user_id = self.user.get('account_id')
r = self.session.post(f'https://{self._store_gql_host}/graphql',
headers={'user-agent': self._store_user_agent},
json=dict(query=uplay_redeem_query,
variables=dict(accountId=user_id,
uplayAccountId=uplay_id)))