Reformat file

pull/3/head
Tejasvi Nareddy 6 years ago
parent 8abeaac017
commit 8ed7a39b86

@ -2,9 +2,10 @@ import requests
import json
import os
def write_to_file(url, fname):
with open(fname, "a") as f:
f.write(url+"\n")
f.write(url + "\n")
def main():
@ -22,14 +23,17 @@ def main():
username = input("\033[92;1m[\033[37;1m?\033[92;1m]\033[92;1m Input Username: \033[0m")
print()
fname = username+".txt"
fname = username + ".txt"
if os.path.isfile(fname):
os.remove(fname)
print("\033[1;92m[\033[0m\033[1;77m*\033[0m\033[1;92m] Removing previous file:\033[1;37m {}\033[0m".format(fname))
print(
"\033[1;92m[\033[0m\033[1;77m*\033[0m\033[1;92m] Removing previous file:\033[1;37m {}\033[0m".format(fname))
print("\033[1;92m[\033[0m\033[1;77m*\033[0m\033[1;92m] Checking username\033[0m\033[1;37m {}\033[0m\033[1;92m on: \033[0m".format(username))
print(
"\033[1;92m[\033[0m\033[1;77m*\033[0m\033[1;92m] Checking username\033[0m\033[1;37m {}\033[0m\033[1;92m on: "
"\033[0m".format(
username))
raw = open("data.json", "r")
data = json.load(raw)
@ -44,7 +48,6 @@ def main():
url = data.get(social_network).get("url").format(username)
error_type = data.get(social_network).get("errorType")
r = requests.get(url, headers=headers)
if error_type == "message":
@ -75,6 +78,7 @@ def main():
else:
print("\033[37;1m[\033[91;1m-\033[37;1m]\033[92;1m {}:\033[93;1m Not Found!".format(social_network))
print("\033[1;92m[\033[0m\033[1;77m*\033[0m\033[1;92m] Saved: \033[37;1m{}\033[0m".format(username+".txt"))
print("\033[1;92m[\033[0m\033[1;77m*\033[0m\033[1;92m] Saved: \033[37;1m{}\033[0m".format(username + ".txt"))
main()
Loading…
Cancel
Save