Комплект входа в Snapchat с PythonPython

Программы на Python
Anonymous
Комплект входа в Snapchat с Python

Сообщение Anonymous »

Я пытаюсь сгенерировать URL-адрес Oauth с помощью Python и могу сгенерировать, но когда я нажимаю на URL-адрес из Snap, я получаю только сообщение «Что-то пошло не так» и никаких других сообщений или ошибок...
Изображение

Ниже мой Snapchat с кодом Python

Код: Выделить всё

from urllib.parse import urlencode, quote

SNAPCHAT_API_KEY = "#####################"
SNAPCHAT_API_SECRET = "##################"

SNAPCHAT_OAUTH_CALLBACK_URL = "https://localhost:3000"

class SnapchatAPI:

def __init__(self):
self.api_key = SNAPCHAT_API_KEY
self.api_secret = SNAPCHAT_API_SECRET
self.oauth_callback_url = SNAPCHAT_OAUTH_CALLBACK_URL
self.permissions = ["display_name", "external_id"]
self.auth_url = "https://accounts.snapchat.com/accounts/oauth2/auth"

def snapchat_login(self):
try:
query_param_string = urlencode(
{
"client_id": self.api_key,
"redirect_uri": self.oauth_callback_url,
"response_type": "code",
"scope": " ".join(self.permissions),
},
quote_via=quote,
)

# if state:
#     query_param_string += f"&state={state}"

return f"{self.auth_url}?{query_param_string}"

except Exception as e:
print(e)
return None

Я получаю URL-адрес...

Код: Выделить всё

https://accounts.snapchat.com/accounts/oauth2/auth?client_id=##############&redirect_uri=https%3A%2F%2Flocalhost%3A3000%2Ftwitter&response_type=code&scope=display_name%20external_id
В чем проблема и как ее исправить? Альтернативно, есть ли лучший способ реализовать вход в Snapchat с помощью Python?

Подробнее здесь: https://stackoverflow.com/questions/777 ... ith-python

Вернуться в «Python»