Failed to establish a new connection Discord.py
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
Hello in my code it break my request, i tried several time , but after 1-2 hours bot status no longer changed.
i hosting those files in ftp server.
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import random
from discord import Game
import math, time
import requests
Client = discord.client
client = commands.Bot(command_prefix = '!')
Clientdiscord = discord.Client()
@client.event
async def on_ready():
client.loop.create_task(scheduler())
print('project ready')
async def scheduler():
while True:
# sleep until the next whole second
now = time.time()
await asyncio.sleep(math.ceil(now) - now)
await client.change_presence(game=discord.Game(name='steady', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='ready', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='go', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='Total Used : '+requests.get('http://username.mydomain/project/total_visit/count.txt').text, type=3))
await asyncio.sleep(10)
await client.change_presence(game=discord.Game(name='Online : '+requests.get('http://username.mydomain/project/total_online/Live.php').text, type=3))
await asyncio.sleep(10)
await client.change_presence(game=discord.Game(name='Total Users : '+requests.get('http://username.mydomain/project/total_users/total.php').text, type=3))
await asyncio.sleep(10)
await client.change_presence(game=discord.Game(name='return again', type=3))
#i tired to kill all request to start clear again.
client.logout()
client.close()
await asyncio.sleep(20)
client.run("client_token")
Task exception was never retrieved
future: exception=ConnectionError(MaxRetryError("HTTPConnectionPool(host='username.mydomain', port=80): Max retries exceeded with url: /project/total_visit/count.txt (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))",),)>
Traceback (most recent call last):
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3utilconnection.py", line 80, in create_connection
raise err
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3utilconnection.py", line 70, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 600, in urlopen
chunked=chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1026, in _send_output
self.send(msg)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 964, in send
self.connect()
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connection.py", line 181, in connect
conn = self._new_conn()
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsadapters.py", line 449, in send
timeout=timeout
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3utilretry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='username.mydomain', port=80): Max retries exceeded with url: /project/total_visit/count.txt (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersAdministratorDesktopbot.py", line 33, in scheduler
await client.change_presence(game=discord.Game(name='Total Used : '+requests.get('http://username.mydomain/project/total_visit/count.txt').text, type=3))
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsapi.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsapi.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestssessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestssessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsadapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='username.mydomain', port=80): Max retries exceeded with url: /project/total_visit/count.txt (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))
python-3.x python-requests python-multithreading discord.py
add a comment |
Hello in my code it break my request, i tried several time , but after 1-2 hours bot status no longer changed.
i hosting those files in ftp server.
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import random
from discord import Game
import math, time
import requests
Client = discord.client
client = commands.Bot(command_prefix = '!')
Clientdiscord = discord.Client()
@client.event
async def on_ready():
client.loop.create_task(scheduler())
print('project ready')
async def scheduler():
while True:
# sleep until the next whole second
now = time.time()
await asyncio.sleep(math.ceil(now) - now)
await client.change_presence(game=discord.Game(name='steady', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='ready', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='go', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='Total Used : '+requests.get('http://username.mydomain/project/total_visit/count.txt').text, type=3))
await asyncio.sleep(10)
await client.change_presence(game=discord.Game(name='Online : '+requests.get('http://username.mydomain/project/total_online/Live.php').text, type=3))
await asyncio.sleep(10)
await client.change_presence(game=discord.Game(name='Total Users : '+requests.get('http://username.mydomain/project/total_users/total.php').text, type=3))
await asyncio.sleep(10)
await client.change_presence(game=discord.Game(name='return again', type=3))
#i tired to kill all request to start clear again.
client.logout()
client.close()
await asyncio.sleep(20)
client.run("client_token")
Task exception was never retrieved
future: exception=ConnectionError(MaxRetryError("HTTPConnectionPool(host='username.mydomain', port=80): Max retries exceeded with url: /project/total_visit/count.txt (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))",),)>
Traceback (most recent call last):
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3utilconnection.py", line 80, in create_connection
raise err
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3utilconnection.py", line 70, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 600, in urlopen
chunked=chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1026, in _send_output
self.send(msg)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 964, in send
self.connect()
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connection.py", line 181, in connect
conn = self._new_conn()
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsadapters.py", line 449, in send
timeout=timeout
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3utilretry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='username.mydomain', port=80): Max retries exceeded with url: /project/total_visit/count.txt (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersAdministratorDesktopbot.py", line 33, in scheduler
await client.change_presence(game=discord.Game(name='Total Used : '+requests.get('http://username.mydomain/project/total_visit/count.txt').text, type=3))
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsapi.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsapi.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestssessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestssessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsadapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='username.mydomain', port=80): Max retries exceeded with url: /project/total_visit/count.txt (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))
python-3.x python-requests python-multithreading discord.py
add a comment |
Hello in my code it break my request, i tried several time , but after 1-2 hours bot status no longer changed.
i hosting those files in ftp server.
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import random
from discord import Game
import math, time
import requests
Client = discord.client
client = commands.Bot(command_prefix = '!')
Clientdiscord = discord.Client()
@client.event
async def on_ready():
client.loop.create_task(scheduler())
print('project ready')
async def scheduler():
while True:
# sleep until the next whole second
now = time.time()
await asyncio.sleep(math.ceil(now) - now)
await client.change_presence(game=discord.Game(name='steady', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='ready', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='go', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='Total Used : '+requests.get('http://username.mydomain/project/total_visit/count.txt').text, type=3))
await asyncio.sleep(10)
await client.change_presence(game=discord.Game(name='Online : '+requests.get('http://username.mydomain/project/total_online/Live.php').text, type=3))
await asyncio.sleep(10)
await client.change_presence(game=discord.Game(name='Total Users : '+requests.get('http://username.mydomain/project/total_users/total.php').text, type=3))
await asyncio.sleep(10)
await client.change_presence(game=discord.Game(name='return again', type=3))
#i tired to kill all request to start clear again.
client.logout()
client.close()
await asyncio.sleep(20)
client.run("client_token")
Task exception was never retrieved
future: exception=ConnectionError(MaxRetryError("HTTPConnectionPool(host='username.mydomain', port=80): Max retries exceeded with url: /project/total_visit/count.txt (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))",),)>
Traceback (most recent call last):
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3utilconnection.py", line 80, in create_connection
raise err
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3utilconnection.py", line 70, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 600, in urlopen
chunked=chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1026, in _send_output
self.send(msg)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 964, in send
self.connect()
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connection.py", line 181, in connect
conn = self._new_conn()
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsadapters.py", line 449, in send
timeout=timeout
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3utilretry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='username.mydomain', port=80): Max retries exceeded with url: /project/total_visit/count.txt (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersAdministratorDesktopbot.py", line 33, in scheduler
await client.change_presence(game=discord.Game(name='Total Used : '+requests.get('http://username.mydomain/project/total_visit/count.txt').text, type=3))
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsapi.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsapi.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestssessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestssessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsadapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='username.mydomain', port=80): Max retries exceeded with url: /project/total_visit/count.txt (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))
python-3.x python-requests python-multithreading discord.py
Hello in my code it break my request, i tried several time , but after 1-2 hours bot status no longer changed.
i hosting those files in ftp server.
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import random
from discord import Game
import math, time
import requests
Client = discord.client
client = commands.Bot(command_prefix = '!')
Clientdiscord = discord.Client()
@client.event
async def on_ready():
client.loop.create_task(scheduler())
print('project ready')
async def scheduler():
while True:
# sleep until the next whole second
now = time.time()
await asyncio.sleep(math.ceil(now) - now)
await client.change_presence(game=discord.Game(name='steady', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='ready', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='go', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='Total Used : '+requests.get('http://username.mydomain/project/total_visit/count.txt').text, type=3))
await asyncio.sleep(10)
await client.change_presence(game=discord.Game(name='Online : '+requests.get('http://username.mydomain/project/total_online/Live.php').text, type=3))
await asyncio.sleep(10)
await client.change_presence(game=discord.Game(name='Total Users : '+requests.get('http://username.mydomain/project/total_users/total.php').text, type=3))
await asyncio.sleep(10)
await client.change_presence(game=discord.Game(name='return again', type=3))
#i tired to kill all request to start clear again.
client.logout()
client.close()
await asyncio.sleep(20)
client.run("client_token")
Task exception was never retrieved
future: exception=ConnectionError(MaxRetryError("HTTPConnectionPool(host='username.mydomain', port=80): Max retries exceeded with url: /project/total_visit/count.txt (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))",),)>
Traceback (most recent call last):
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3utilconnection.py", line 80, in create_connection
raise err
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3utilconnection.py", line 70, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 600, in urlopen
chunked=chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 1026, in _send_output
self.send(msg)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libhttpclient.py", line 964, in send
self.connect()
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connection.py", line 181, in connect
conn = self._new_conn()
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsadapters.py", line 449, in send
timeout=timeout
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3utilretry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='username.mydomain', port=80): Max retries exceeded with url: /project/total_visit/count.txt (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersAdministratorDesktopbot.py", line 33, in scheduler
await client.change_presence(game=discord.Game(name='Total Used : '+requests.get('http://username.mydomain/project/total_visit/count.txt').text, type=3))
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsapi.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsapi.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestssessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestssessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesrequestsadapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='username.mydomain', port=80): Max retries exceeded with url: /project/total_visit/count.txt (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))
python-3.x python-requests python-multithreading discord.py
python-3.x python-requests python-multithreading discord.py
asked Jan 4 at 6:35
Darzy08Darzy08
167
167
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
definitely you must to get error,, you made many get.requests.
to slove it, try (Close request) / (restart Bot [background Command])
hm im not good enough, but you can try my step's
1) add Full (urllib3 library)
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import random
from discord import Game
import math, time
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import urllib3
import urllib3.contrib.pyopenssl
import certifi
2) add (Backgroundworker) Command [will restart your get.request every time.]
Client = discord.client
client = commands.Bot(command_prefix = '!')
Clientdiscord = discord.Client()
urllib3.contrib.pyopenssl.inject_into_urllib3()
@client.event
async def on_ready():
print('Project Runing..!')
async def task():
await client.wait_until_ready()
while True:
await client.change_presence(game=discord.Game(name='Loading..!', type=3))
print('Get_Url-Refresh')
await asyncio.sleep(1)
print('Total_Used')
one = requests.get('http://username.mydomain/project/total_visit/count.txt', timeout=5)
print('Total_Online')
two = requests.get('http://username.mydomain/project/total_online/Live.php', timeout=5)
print('Total_Users')
three = requests.get('http://username.mydomain/project/total_users/total.php', timeout=5)
await asyncio.sleep(1)
print('Refresh Request')
await asyncio.sleep(10)
print('Running')
await client.change_presence(game=discord.Game(name='steady', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='ready', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='go', type=3))
await asyncio.sleep(5)
print('Total Used..!')
await client.change_presence(game=discord.Game(name='Total Used : ' + one.text, type=3))
await asyncio.sleep(5)
print('Online..!')
await client.change_presence(game=discord.Game(name='Online : ' + two.text, type=1))
await asyncio.sleep(5)
print('Total Users..!')
await client.change_presence(game=discord.Game(name='Total Users : ' + three.text, type=3))
await asyncio.sleep(5)
print('Refresh..!')
def handle_exit():
print("Handling")
client.loop.run_until_complete(client.logout())
for t in asyncio.Task.all_tasks(loop=client.loop):
if t.done():
t.exception()
continue
t.cancel()
try:
client.loop.run_until_complete(asyncio.wait_for(t, 5, loop=client.loop))
t.exception()
except asyncio.InvalidStateError:
pass
except asyncio.TimeoutError:
pass
except asyncio.CancelledError:
pass
while True:
@client.event
async def on_message(m):
if m.content == 'die':
print("Terminating")
raise SystemExit
client.loop.create_task(task())
try:
client.loop.run_until_complete(client.start('You_Token_Here'))
except SystemExit:
handle_exit()
except KeyboardInterrupt:
handle_exit()
client.loop.close()
print("Program ended")
break
print("Bot restarting")
client = discord.Client(loop=client.loop)
Credits to Dev I.A (Gamer's Control).
i think i got what you mean, cool. Thanks for your help. i will test it,
– Darzy08
Jan 7 at 11:20
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54034096%2ffailed-to-establish-a-new-connection-discord-py%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
definitely you must to get error,, you made many get.requests.
to slove it, try (Close request) / (restart Bot [background Command])
hm im not good enough, but you can try my step's
1) add Full (urllib3 library)
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import random
from discord import Game
import math, time
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import urllib3
import urllib3.contrib.pyopenssl
import certifi
2) add (Backgroundworker) Command [will restart your get.request every time.]
Client = discord.client
client = commands.Bot(command_prefix = '!')
Clientdiscord = discord.Client()
urllib3.contrib.pyopenssl.inject_into_urllib3()
@client.event
async def on_ready():
print('Project Runing..!')
async def task():
await client.wait_until_ready()
while True:
await client.change_presence(game=discord.Game(name='Loading..!', type=3))
print('Get_Url-Refresh')
await asyncio.sleep(1)
print('Total_Used')
one = requests.get('http://username.mydomain/project/total_visit/count.txt', timeout=5)
print('Total_Online')
two = requests.get('http://username.mydomain/project/total_online/Live.php', timeout=5)
print('Total_Users')
three = requests.get('http://username.mydomain/project/total_users/total.php', timeout=5)
await asyncio.sleep(1)
print('Refresh Request')
await asyncio.sleep(10)
print('Running')
await client.change_presence(game=discord.Game(name='steady', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='ready', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='go', type=3))
await asyncio.sleep(5)
print('Total Used..!')
await client.change_presence(game=discord.Game(name='Total Used : ' + one.text, type=3))
await asyncio.sleep(5)
print('Online..!')
await client.change_presence(game=discord.Game(name='Online : ' + two.text, type=1))
await asyncio.sleep(5)
print('Total Users..!')
await client.change_presence(game=discord.Game(name='Total Users : ' + three.text, type=3))
await asyncio.sleep(5)
print('Refresh..!')
def handle_exit():
print("Handling")
client.loop.run_until_complete(client.logout())
for t in asyncio.Task.all_tasks(loop=client.loop):
if t.done():
t.exception()
continue
t.cancel()
try:
client.loop.run_until_complete(asyncio.wait_for(t, 5, loop=client.loop))
t.exception()
except asyncio.InvalidStateError:
pass
except asyncio.TimeoutError:
pass
except asyncio.CancelledError:
pass
while True:
@client.event
async def on_message(m):
if m.content == 'die':
print("Terminating")
raise SystemExit
client.loop.create_task(task())
try:
client.loop.run_until_complete(client.start('You_Token_Here'))
except SystemExit:
handle_exit()
except KeyboardInterrupt:
handle_exit()
client.loop.close()
print("Program ended")
break
print("Bot restarting")
client = discord.Client(loop=client.loop)
Credits to Dev I.A (Gamer's Control).
i think i got what you mean, cool. Thanks for your help. i will test it,
– Darzy08
Jan 7 at 11:20
add a comment |
definitely you must to get error,, you made many get.requests.
to slove it, try (Close request) / (restart Bot [background Command])
hm im not good enough, but you can try my step's
1) add Full (urllib3 library)
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import random
from discord import Game
import math, time
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import urllib3
import urllib3.contrib.pyopenssl
import certifi
2) add (Backgroundworker) Command [will restart your get.request every time.]
Client = discord.client
client = commands.Bot(command_prefix = '!')
Clientdiscord = discord.Client()
urllib3.contrib.pyopenssl.inject_into_urllib3()
@client.event
async def on_ready():
print('Project Runing..!')
async def task():
await client.wait_until_ready()
while True:
await client.change_presence(game=discord.Game(name='Loading..!', type=3))
print('Get_Url-Refresh')
await asyncio.sleep(1)
print('Total_Used')
one = requests.get('http://username.mydomain/project/total_visit/count.txt', timeout=5)
print('Total_Online')
two = requests.get('http://username.mydomain/project/total_online/Live.php', timeout=5)
print('Total_Users')
three = requests.get('http://username.mydomain/project/total_users/total.php', timeout=5)
await asyncio.sleep(1)
print('Refresh Request')
await asyncio.sleep(10)
print('Running')
await client.change_presence(game=discord.Game(name='steady', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='ready', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='go', type=3))
await asyncio.sleep(5)
print('Total Used..!')
await client.change_presence(game=discord.Game(name='Total Used : ' + one.text, type=3))
await asyncio.sleep(5)
print('Online..!')
await client.change_presence(game=discord.Game(name='Online : ' + two.text, type=1))
await asyncio.sleep(5)
print('Total Users..!')
await client.change_presence(game=discord.Game(name='Total Users : ' + three.text, type=3))
await asyncio.sleep(5)
print('Refresh..!')
def handle_exit():
print("Handling")
client.loop.run_until_complete(client.logout())
for t in asyncio.Task.all_tasks(loop=client.loop):
if t.done():
t.exception()
continue
t.cancel()
try:
client.loop.run_until_complete(asyncio.wait_for(t, 5, loop=client.loop))
t.exception()
except asyncio.InvalidStateError:
pass
except asyncio.TimeoutError:
pass
except asyncio.CancelledError:
pass
while True:
@client.event
async def on_message(m):
if m.content == 'die':
print("Terminating")
raise SystemExit
client.loop.create_task(task())
try:
client.loop.run_until_complete(client.start('You_Token_Here'))
except SystemExit:
handle_exit()
except KeyboardInterrupt:
handle_exit()
client.loop.close()
print("Program ended")
break
print("Bot restarting")
client = discord.Client(loop=client.loop)
Credits to Dev I.A (Gamer's Control).
i think i got what you mean, cool. Thanks for your help. i will test it,
– Darzy08
Jan 7 at 11:20
add a comment |
definitely you must to get error,, you made many get.requests.
to slove it, try (Close request) / (restart Bot [background Command])
hm im not good enough, but you can try my step's
1) add Full (urllib3 library)
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import random
from discord import Game
import math, time
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import urllib3
import urllib3.contrib.pyopenssl
import certifi
2) add (Backgroundworker) Command [will restart your get.request every time.]
Client = discord.client
client = commands.Bot(command_prefix = '!')
Clientdiscord = discord.Client()
urllib3.contrib.pyopenssl.inject_into_urllib3()
@client.event
async def on_ready():
print('Project Runing..!')
async def task():
await client.wait_until_ready()
while True:
await client.change_presence(game=discord.Game(name='Loading..!', type=3))
print('Get_Url-Refresh')
await asyncio.sleep(1)
print('Total_Used')
one = requests.get('http://username.mydomain/project/total_visit/count.txt', timeout=5)
print('Total_Online')
two = requests.get('http://username.mydomain/project/total_online/Live.php', timeout=5)
print('Total_Users')
three = requests.get('http://username.mydomain/project/total_users/total.php', timeout=5)
await asyncio.sleep(1)
print('Refresh Request')
await asyncio.sleep(10)
print('Running')
await client.change_presence(game=discord.Game(name='steady', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='ready', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='go', type=3))
await asyncio.sleep(5)
print('Total Used..!')
await client.change_presence(game=discord.Game(name='Total Used : ' + one.text, type=3))
await asyncio.sleep(5)
print('Online..!')
await client.change_presence(game=discord.Game(name='Online : ' + two.text, type=1))
await asyncio.sleep(5)
print('Total Users..!')
await client.change_presence(game=discord.Game(name='Total Users : ' + three.text, type=3))
await asyncio.sleep(5)
print('Refresh..!')
def handle_exit():
print("Handling")
client.loop.run_until_complete(client.logout())
for t in asyncio.Task.all_tasks(loop=client.loop):
if t.done():
t.exception()
continue
t.cancel()
try:
client.loop.run_until_complete(asyncio.wait_for(t, 5, loop=client.loop))
t.exception()
except asyncio.InvalidStateError:
pass
except asyncio.TimeoutError:
pass
except asyncio.CancelledError:
pass
while True:
@client.event
async def on_message(m):
if m.content == 'die':
print("Terminating")
raise SystemExit
client.loop.create_task(task())
try:
client.loop.run_until_complete(client.start('You_Token_Here'))
except SystemExit:
handle_exit()
except KeyboardInterrupt:
handle_exit()
client.loop.close()
print("Program ended")
break
print("Bot restarting")
client = discord.Client(loop=client.loop)
Credits to Dev I.A (Gamer's Control).
definitely you must to get error,, you made many get.requests.
to slove it, try (Close request) / (restart Bot [background Command])
hm im not good enough, but you can try my step's
1) add Full (urllib3 library)
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import random
from discord import Game
import math, time
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import urllib3
import urllib3.contrib.pyopenssl
import certifi
2) add (Backgroundworker) Command [will restart your get.request every time.]
Client = discord.client
client = commands.Bot(command_prefix = '!')
Clientdiscord = discord.Client()
urllib3.contrib.pyopenssl.inject_into_urllib3()
@client.event
async def on_ready():
print('Project Runing..!')
async def task():
await client.wait_until_ready()
while True:
await client.change_presence(game=discord.Game(name='Loading..!', type=3))
print('Get_Url-Refresh')
await asyncio.sleep(1)
print('Total_Used')
one = requests.get('http://username.mydomain/project/total_visit/count.txt', timeout=5)
print('Total_Online')
two = requests.get('http://username.mydomain/project/total_online/Live.php', timeout=5)
print('Total_Users')
three = requests.get('http://username.mydomain/project/total_users/total.php', timeout=5)
await asyncio.sleep(1)
print('Refresh Request')
await asyncio.sleep(10)
print('Running')
await client.change_presence(game=discord.Game(name='steady', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='ready', type=3))
await asyncio.sleep(5)
await client.change_presence(game=discord.Game(name='go', type=3))
await asyncio.sleep(5)
print('Total Used..!')
await client.change_presence(game=discord.Game(name='Total Used : ' + one.text, type=3))
await asyncio.sleep(5)
print('Online..!')
await client.change_presence(game=discord.Game(name='Online : ' + two.text, type=1))
await asyncio.sleep(5)
print('Total Users..!')
await client.change_presence(game=discord.Game(name='Total Users : ' + three.text, type=3))
await asyncio.sleep(5)
print('Refresh..!')
def handle_exit():
print("Handling")
client.loop.run_until_complete(client.logout())
for t in asyncio.Task.all_tasks(loop=client.loop):
if t.done():
t.exception()
continue
t.cancel()
try:
client.loop.run_until_complete(asyncio.wait_for(t, 5, loop=client.loop))
t.exception()
except asyncio.InvalidStateError:
pass
except asyncio.TimeoutError:
pass
except asyncio.CancelledError:
pass
while True:
@client.event
async def on_message(m):
if m.content == 'die':
print("Terminating")
raise SystemExit
client.loop.create_task(task())
try:
client.loop.run_until_complete(client.start('You_Token_Here'))
except SystemExit:
handle_exit()
except KeyboardInterrupt:
handle_exit()
client.loop.close()
print("Program ended")
break
print("Bot restarting")
client = discord.Client(loop=client.loop)
Credits to Dev I.A (Gamer's Control).
answered Jan 7 at 11:17
Dev I.ADev I.A
1486
1486
i think i got what you mean, cool. Thanks for your help. i will test it,
– Darzy08
Jan 7 at 11:20
add a comment |
i think i got what you mean, cool. Thanks for your help. i will test it,
– Darzy08
Jan 7 at 11:20
i think i got what you mean, cool. Thanks for your help. i will test it,
– Darzy08
Jan 7 at 11:20
i think i got what you mean, cool. Thanks for your help. i will test it,
– Darzy08
Jan 7 at 11:20
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54034096%2ffailed-to-establish-a-new-connection-discord-py%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown