Closed RuochenFu21 closed 2 years ago
Same issue
I'm already working on it.
The probably solution is to send requests with selenium instead of requests+lxml. It's not so fast, I have to rewrite nearly half of the code.
The problem may be caused by the easy to detect Python's HTTP stack or Heroku/Replit IP addresses.
I'm already working on it. The probably solution is to send requests with selenium instead of requests+lxml. It's not so fast, I have to rewrite nearly half of the code.
The problem may be caused by the easy to detect Python's HTTP stack or Heroku/Replit IP addresses.
Seems like after I tried running the application on my own PC, the problem has been solved. Probably Replit/Heroku IP addresses are unable to bypass Cloudflare's captcha.
doing with replit and making it with a discord bot gave me the same errors
from python_aternos import Client
from webserver import keep_alive
import discord
from discord.ext import commands
client = discord.Client()
bot = commands.Bot(command_prefix='{', help_command=None)
@bot.command()
async def startServer(ctx):
try:
aternos = Client.from_credentials("test", "test")
except Exception as e:
await ctx.send("Couldn't log in.")
await ctx.send(f"Error: {e}")
else:
servs = aternos.list_servers()
for serv in servs:
if serv.address == 'test':
myserver = serv
try:
myserver.start()
except:
await ctx.send("Server couldn't open.")
else:
await ctx.send("SERVER SUCESSFULLY OPENED!\nServer Address: aftermathicsmp.aternos.me\nPort: 24119")
keep_alive()
bot.run(os.environ['bot_token'])```
I'm already working on it. The probably solution is to send requests with selenium instead of requests+lxml. It's not so fast, I have to rewrite nearly half of the code.
The problem may be caused by the easy to detect Python's HTTP stack or Heroku/Replit IP addresses.
any updates on the cloudfare bypass ?. I have tried to run it on every platform on heroku , replit and even hosted it on my own vps but did not worked same could not bypass cloudflare but it is working fine on windows like on local machine but fails on a vps or other service. So just wanna know if any updates were coming or not ?
@DewanshNehra, I decided to parse Cloudflare page with js2py, because selenium requires installed browser.
I hope I'll do it. Wait for some news tomorrow.
@DarkCat09 doesnt work on my own laptop also(need more than 5 trys)
I'm already working on it. The probably solution is to send requests with selenium instead of requests+lxml. It's not so fast, I have to rewrite nearly half of the code.
The problem may be caused by the easy to detect Python's HTTP stack or Heroku/Replit IP addresses.
Hi, if ever cloudscraper returns an error. Why not use undetected-chromedriver, collect the cookies and browser header and use the collected cookies to the requests module. It works all the time. Let me know if you want more information
is the problem solved?
I did it! To bypass Cloudflare, python-aternos need to update requests.Session
and wait before each new attempt.
Details: https://github.com/DarkCat09/python-aternos/commit/dc52f929856d71a9e8e170caa7b18211486eed13#diff-13f0cf5511b5689db9ce01d005de5d7e9a75537bac16c7c8dd35e39a70a14b49R201
Update to the latest version: v1.1.2
And I've checked it on Repl.it, cloudscraper works: https://replit.com/@DCat09/PythonAternosTest
If the problem will appear again, reopen this issue.
Unable to bypass Cloudflare protection