
Ниже мой 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
Код: Выделить всё
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
Подробнее здесь: https://stackoverflow.com/questions/777 ... ith-python