@Bethce

Python https как исправить?

Traceback
Ignoring exception in on_ready
Traceback (most recent call last):
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Артур\Desktop\BOM\BOM.py", line 25, in on_ready
    item = await memes_submissions.__anext__()
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\asyncpraw\models\listing\generator.py", line 63, in __anext__
    await self._next_batch()
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\asyncpraw\models\listing\generator.py", line 73, in _next_batch
    self._listing = await self._reddit.get(self.url, params=self.params)
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\asyncpraw\reddit.py", line 661, in get
    return await self._objectify_request(method="GET", params=params, path=path)
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\asyncpraw\reddit.py", line 771, in _objectify_request
    path=path,
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\asyncpraw\reddit.py", line 974, in request
    json=json,
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\asyncprawcore\sessions.py", line 376, in request
    url=url,
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\asyncprawcore\sessions.py", line 277, in _request_with_retries
    url,
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\asyncprawcore\sessions.py", line 196, in _make_request
    timeout=timeout,
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\asyncprawcore\rate_limit.py", line 34, in call
    kwargs["headers"] = await set_header_callback()
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\asyncprawcore\sessions.py", line 322, in _set_header_callback
    await self._authorizer.refresh()
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\asyncprawcore\auth.py", line 371, in refresh
    await self._request_token(grant_type="client_credentials", **additional_kwargs)
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\asyncprawcore\auth.py", line 153, in _request_token
    response = await self._authenticator._post(url, **data)
  File "C:\Users\Артур\AppData\Local\Programs\Python\Python36\lib\site-packages\asyncprawcore\auth.py", line 41, in _post
    raise ResponseException(response)
asyncprawcore.exceptions.ResponseException: received 401 HTTP response


import discord
import asyncpraw
import asyncio
import os
import config

bot = discord.Client( )
reddit = asyncpraw.Reddit(client_id=config.settings["CLIENT_ID"],
					client_secret=config.settings ["SECRET_CODE"],
					user_agent='random_raddit_bot /0.0.1')

mems = []
TIMEOUT = 5
ID_CHANNEL = 988486164581318677
SUBREDDIT_NAME = 'memes'
POST_LIMIT = 1

@bot.event
async def on_ready():
	channel = bot.get_channel (ID_CHANNEL)
	while True:
		await asyncio.sleep (TIMEOUT)
		memes_submissions = await reddit.subreddit (SUBREDDIT_NAME)
		memes_submissions = memes_submissions.new (limit=POST_LIMIT)
		item = await memes_submissions.__anext__()
		if item.title not in mems :
			mems.append (item.title)
			await channel.send (item.url)

bot.run (config.settings["DISCORD_TOKEN"])
  • Вопрос задан
  • 117 просмотров
Пригласить эксперта
Ответы на вопрос 1
Dr_Elvis
@Dr_Elvis Куратор тега Python
В гугле забанен
client_secret=config.settings ["SECRET_CODE"],
Пробел затисался после settings
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы
23 нояб. 2024, в 00:16
2000 руб./за проект
22 нояб. 2024, в 23:55
3000 руб./за проект
22 нояб. 2024, в 22:26
3500 руб./за проект