Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Improve headers, add locale #211

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Improve headers, add locale #211

wants to merge 2 commits into from

Conversation

michikrug
Copy link

Add missing headers
Add locale for parameter and accept language

Copy link
Contributor

@nullpixel nullpixel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall

@@ -70,7 +82,7 @@ def user_login(self, username=None, password=None, retry=True):
now = get_time()

try:
r = self._session.get(self.PTC_LOGIN_URL1, timeout=self.timeout)
r = self._session.get(self.PTC_LOGIN_URL1, params={'client_id': 'mobile-app_pokemon-go', 'redirect_uri': 'https://www.nianticlabs.com/pokemongo/error', 'locale': self.locale}, timeout=self.timeout)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make these params a variable, like in the other changes

})
except (ValueError, AttributeError) as e:
self.log.error('PTC User Login Error - invalid JSON response: {}'.format(e))
raise AuthException('Invalid JSON response: {}'.format(e))

try:
r = self._session.post(self.PTC_LOGIN_URL2, data=data, timeout=self.timeout, allow_redirects=False)
r = self._session.post(self.PTC_LOGIN_URL2, params={'service': 'http://sso.pokemon.com/sso/oauth2.0/callbackAuthorize'}, headers={'Content-Type': 'application/x-www-form-urlencoded'}, data=data, timeout=self.timeout, allow_redirects=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@michikrug
Copy link
Author

I have also adapted the PR from ZeChrales for aiopogo to pgoapi:

Noctem#8
->
https://github.com/michikrug/pgoapi/commit/c203c1bf1eb65dc6dccc93f6e08569295a975a24

Since I have absolutely no idea if this is correct at all, I would be interested if some of you can have a look.

I don't know if we should wait to have this changes approved and then rather merge those changes instead of just some missing headers.

@ZeChrales
Copy link
Contributor

I don't know if you read it on discord :
"Chrales: I don't know who made the pgoapi PR about ptc login, but I'll update it like aiopogo's one whenever noctem will validate it first"
I want to really be 1:1 with real login flow, but need to finish tests on py3 first.

@michikrug
Copy link
Author

Allright, I'm looking forward to it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

4 participants