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

Password Generator Created #1111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions jarviscli/plugins/password_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from plugin import plugin
from colorama import Fore
import requests

@plugin("generate_password")

Copy link
Contributor

Choose a reason for hiding this comment

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

remove whitespace

def generate_password(jarvis, s):
length = int(jarvis.input("Desire password length: "))
inp = str(jarvis.input("Would you like to exclude numbers? (Y/N) : "))
Copy link
Contributor

Choose a reason for hiding this comment

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

casting to a str here is un-necessary, by default an input return type is str.

if(inp == 'Y'):
exclude_numbers = True
else:
exclude_numbers = False

inp = bool(jarvis.input("Would you like to exclude special characters? (Y/N) : "))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fairly certain this would always evaluate to true as any string is a truthy value.

if(inp == 'Y'):
exclude_special = True
else:
exclude_special = False
api_url = 'https://api.api-ninjas.com/v1/passwordgenerator?length={}'.format(length, exclude_numbers, exclude_special)
response = requests.get(api_url, headers={'X-Api-Key': 'dDcouxccX+Ne1OKZj+rRrw==CW8Mg7Tvlk3u8omW'})
if response.status_code == requests.codes.ok:
print(response.text)
else:
print("Error:", response.status_code, response.text)