Python脚本不起作用,但没有给出错误信息任何帮助

问题描述 投票:0回答:1

我通常对编程/脚本是陌生的,只是开始了解python3.8的工作原理。无论如何,我这里有一个我一直在致力于随机生成Instagram帐户生成器的脚本。

如果这看起来像是一个愚蠢的问题,请原谅,但我毕竟是新手:(。当我运行上述脚本时,我没有收到任何输出,也没有收到错误消息,导致我不知道我到底在做什么错!

import random
import string
from threading import Thread
from discord_webhook import DiscordWebhook
from discord_webhook import DiscordWebhook, DiscordEmbed


webhookbro = "webhook"#Discord WebHook
password = "MadeWithLoveByOnurCreed"
threads_ammount = 50

max_proxies = 0
proxies = [line for line in list(set(open("Proxies.txt", encoding="UTF-8",  errors="ignore").read().splitlines()))]
for x in proxies:
    max_proxies += 1
def run():
    global max_proxies
    while True:
      proxy = proxies[random.randint(0,max_proxies-1)]
      asd = ('').join(random.choices(string.ascii_letters + string.digits, k=10))
      with requests.Session() as (c):
        email = str(asd+"@gmail.com")
        password = "MadeWithLoveByOnurCreed"
        username = str("Jacob"+asd)
        name = str("Jacon"+"P")
        asd = random
        data = {
                'email': email,
                'password': password,
                'username': username,
                'first_name': name,
                'client_id': 'W6mHTAAEAAHsVu2N0wGEChTQpTfn',
                'seamless_login_enabled': '1',
                'gdpr_s': '%5B0%2C2%2C0%2Cnull%5D',
                'tos_version': 'eu',
                'opt_into_one_tap': 'false'
                    }
        headers = {
                'accept': "*/*",
                'accept-encoding': "gzip, deflate, br",
                'accept-language': "en-US,en;q=0.8",
                'content-length': "241",
                'content-type': 'application/x-www-form-urlencoded',
                'origin': "https://www.instagram.com",
                'referer': "https://www.instagram.com/",
                'user-agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
                'x-csrftoken': "95RtiLDyX9J6AcVz9jtUIySbwf75WhvG",
                'x-instagram-ajax': "c7e210fa2eb7",
                'x-requested-with': "XMLHttpRequest",
                'Cache-Control': "no-cache"
                }
        try:
            req = c.post("https://www.instagram.com/accounts/web_create_ajax/",data=data,headers=headers,proxies={'https': 'https://' + proxy,'http':'http://' + proxy}).json()
            try:
                created = req['account_created']
                if created is True:
                    userid = req['user_id']
                    print(f"Successfully Created A Account | Username : {username} | Password : {password}")
                    webhook = DiscordWebhook(url=webhookurlbro, username="Testing")
                    embed = DiscordEmbed(title='Testing', color=242424)
                    embed.set_footer(text='Testing')
                    embed.set_timestamp()
                    embed.add_embed_field(name='Username', value=f'{username}')
                    embed.add_embed_field(name='Password', value=f'{password}')
                    embed.add_embed_field(name='Proxy', value=f'{proxy}')
                    webhook.add_embed(embed)
                    webhook.execute()
                    save = open("Accounts.txt","a")
                    save.write(f"{username}:{password}\n")
                else:
                  dk = None
            except:
                dk = None
        except requests.ConnectionError:
            dk = None
threads = []
for i in range(0,threads_ammount):
    threads.append(Thread(target=run))
for thread in threads:
    thread.start()
for thread in threads:
    thread.join()
python python-3.x instagram python-help
1个回答
0
投票

对不起,我无法发表评论,因此我必须将其写为答案。如何删除try/except块?特别是内层捕获所有异常,因此不会报告任何错误。 (通常建议您始终指定要捕获的异常)

© www.soinside.com 2019 - 2024. All rights reserved.