Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery Starbot ⭐ refactored Vinyzu/DiscordGenerator #102

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch https://github.com/sourcery-ai-bot/DiscordGenerator main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Comment on lines -62 to +68
output += self.token + ":"
output += f"{self.token}:"
if "email" in item and self.email:
output += self.email + ":"
output += f"{self.email}:"
if "pass" in item:
output += self.browser.faker.password + ":"
output += f"{self.browser.faker.password}:"
if "proxy" in item and self.browser.proxy:
output += self.browser.proxy + ":"
output += f"{self.browser.proxy}:"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Generator.log_output refactored with the following changes:

@@ -102,7 +102,6 @@ async def generate_unclaimed(self):
await self.page.click("[class *= 'checkbox']", timeout=10000)
except Exception as e:
self.logger.debug("No TOS Checkbox was detected")
pass
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Generator.generate_unclaimed refactored with the following changes:

This removes the following comments ( why? ):

# Catch Exceptions and save output anyways

@@ -213,7 +211,6 @@ async def generate_token(self):
await tos_box.click()
except Exception as e:
self.logger.debug("No TOS Checkbox was detected")
pass
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Generator.generate_token refactored with the following changes:

This removes the following comments ( why? ):

# Catch Exceptions and save output anyways

Comment on lines -332 to +328
email = True if email == "1" else False
email = email == "1"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function main refactored with the following changes:

headers = {
return {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Discord.get_headers refactored with the following changes:

Comment on lines -19 to +32
def makeHTTPRequest(endpoint):
def makeHTTPRequest(self):
headers = {
"User-Agent": "TempMailPythonAPI/1.0",
"Accept": "application/json"
}
try:
connection = httpx.get(BASE_URL + endpoint, headers=headers)
connection = httpx.get(BASE_URL + self, headers=headers)
if connection.status_code >= 400:
raise Exception("HTTP Error: " + str(connection.status_code))
raise Exception(f"HTTP Error: {str(connection.status_code)}")
except Exception as e:
print(e)
return None

response = connection.text

return response
return connection.text
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TempMail.makeHTTPRequest refactored with the following changes:

Comment on lines -41 to +44
def generateInbox(rush=False):
def generateInbox(self):
try:
random_domain = random.choice(DOMAINS)
s = TempMail.makeHTTPRequest(f"/generate/{random_domain}")
except:
print("Website responded with: " + s)
print(f"Website responded with: {s}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TempMail.generateInbox refactored with the following changes:

Comment on lines -54 to +53
def getEmails(inbox):
s = TempMail.makeHTTPRequest("/auth/" + inbox.token)
def getEmails(self):
s = TempMail.makeHTTPRequest(f"/auth/{self.token}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TempMail.getEmails refactored with the following changes:

Comment on lines -109 to +113
return ("Email (sender={}, recipient={}, subject={}, body={}, html={}, date={} )"
.format(self.sender, self.recipient, self.subject, self.body, self.html, self.date))
return f"Email (sender={self.sender}, recipient={self.recipient}, subject={self.subject}, body={self.body}, html={self.html}, date={self.date} )"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Email.__repr__ refactored with the following changes:

Comment on lines 129 to 130
return ("Inbox (address={}, token={} )"
.format(self.address, self.token)) No newline at end of file
return f"Inbox (address={self.address}, token={self.token} )"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Inbox.__repr__ refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant