Created
October 12, 2016 04:55
-
-
Save jd-war-eagle/f7839beb5c1e2bd06a276aafbfd04a11 to your computer and use it in GitHub Desktop.
Generate a secret codename in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import requests | |
def codename(): | |
length = random.randint(2, 3) | |
words = [] | |
for i in range(length): | |
words.append(get_random_word()) | |
random.shuffle(words) | |
super_secret_codename = ' '.join(words) | |
print(super_secret_codename) | |
return super_secret_codename | |
def get_random_word(): | |
return requests.get('http://www.setgetgo.com/randomword/get.php').text | |
if __name__ == "__main__": | |
# execute only if run as a script | |
codename() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment