mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
[2] trakt auth edits
This commit is contained in:
parent
9d5969abfb
commit
23eccf1af7
2 changed files with 11 additions and 9 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.17.3-develop1
|
||||
1.17.3-develop2
|
||||
|
|
|
@ -123,9 +123,12 @@ class Trakt:
|
|||
logger.info(f"Navigate to: {url}")
|
||||
logger.info("If you get an OAuth error your client_id or client_secret is invalid")
|
||||
webbrowser.open(url, new=2)
|
||||
try: pin = util.logger_input("Trakt pin (case insensitive)", timeout=300).strip()
|
||||
except TimeoutExpired: raise Failed("Input Timeout: Trakt pin required.")
|
||||
if not pin: raise Failed("Trakt Error: Trakt pin required.")
|
||||
try:
|
||||
pin = util.logger_input("Trakt pin (case insensitive)", timeout=300).strip()
|
||||
except TimeoutExpired:
|
||||
raise Failed("Input Timeout: Trakt pin required.")
|
||||
if not pin:
|
||||
raise Failed("Trakt Error: Trakt pin required.")
|
||||
json = {
|
||||
"code": pin,
|
||||
"client_id": self.client_id,
|
||||
|
@ -135,7 +138,8 @@ class Trakt:
|
|||
}
|
||||
response = self.config.post(f"{base_url}/oauth/token", json=json, headers={"Content-Type": "application/json"})
|
||||
if response.status_code != 200:
|
||||
raise Failed("Trakt Error: Invalid trakt pin. If you're sure you typed it in correctly your client_id or client_secret may be invalid")
|
||||
raise Failed(f"Trakt Error: ({response.status_code}) {response.reason}")
|
||||
#raise Failed("Trakt Error: Invalid trakt pin. If you're sure you typed it in correctly your client_id or client_secret may be invalid")
|
||||
elif not self._save(response.json()):
|
||||
raise Failed("Trakt Error: New Authorization Failed")
|
||||
|
||||
|
@ -151,10 +155,8 @@ class Trakt:
|
|||
response = self.config.get(f"{base_url}/users/settings", headers=headers)
|
||||
if response.status_code == 423:
|
||||
raise Failed("Trakt Error: Account is Locked please Contact Trakt Support")
|
||||
if self.config.trace_mode:
|
||||
logger.debug(f"Trakt Error Code: {response.status_code}")
|
||||
logger.debug(f"Trakt Error Reason: {response.reason}")
|
||||
logger.debug(f"Trakt Error JSON: {response.json()}")
|
||||
if response.status_code != 200:
|
||||
logger.debug(f"Trakt Error: ({response.status_code}) {response.reason}")
|
||||
return response.status_code == 200
|
||||
|
||||
def _refresh(self):
|
||||
|
|
Loading…
Reference in a new issue