issy is easy
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
from selenium import webdriver
|
||||
|
||||
webdriver('Chrome')
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
from simple_term_menu import TerminalMenu
|
||||
|
||||
|
||||
def list_files(directory="."):
|
||||
return (file for file in os.listdir(directory) if os.path.isfile(os.path.join(directory, file)))
|
||||
|
||||
|
||||
def main():
|
||||
terminal_menu = TerminalMenu(list_files(), preview_command="cat {}", preview_size=0.75)
|
||||
terminal_menu.show()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
from pygments import formatters, highlight, lexers
|
||||
from pygments.util import ClassNotFound
|
||||
from simple_term_menu import TerminalMenu
|
||||
|
||||
|
||||
def highlight_file(filepath):
|
||||
with open(filepath, "r") as f:
|
||||
file_content = f.read()
|
||||
try:
|
||||
lexer = lexers.get_lexer_for_filename(filepath, stripnl=False, stripall=False)
|
||||
except ClassNotFound:
|
||||
lexer = lexers.get_lexer_by_name("text", stripnl=False, stripall=False)
|
||||
formatter = formatters.TerminalFormatter(bg="dark") # dark or light
|
||||
highlighted_file_content = highlight(file_content, lexer, formatter)
|
||||
return highlighted_file_content
|
||||
|
||||
|
||||
def list_files(directory="."):
|
||||
return (file for file in os.listdir(directory) if os.path.isfile(os.path.join(directory, file)))
|
||||
|
||||
|
||||
def main():
|
||||
terminal_menu = TerminalMenu(list_files(), preview_command=highlight_file, preview_size=0.75)
|
||||
terminal_menu.show()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from simple_term_menu import TerminalMenu
|
||||
|
||||
|
||||
def main():
|
||||
terminal_menu = TerminalMenu(["entry 1", "entry 2", "entry 3"])
|
||||
terminal_menu.show()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,25 @@
|
||||
"""Find locations in issy-les-moulineaux and keep me informed of new offers."""
|
||||
|
||||
import os
|
||||
|
||||
from selenium import webdriver
|
||||
|
||||
URL = "https://logement.isep.fr/"
|
||||
URL_SORTED_BY_CHEAPEST = "https://logement.isep.fr/listelogement.php?tri=n|loyer"
|
||||
|
||||
driver = webdriver.Chrome()
|
||||
driver.get(URL)
|
||||
|
||||
id_value, password_value = os.environ['ISEP_ID'], os.environ['ISEP_PASSWORD']
|
||||
id_field, password_field, submit_field = driver.find_elements_by_tag_name('input')
|
||||
|
||||
id_field.click()
|
||||
id_field.send_keys(id_value)
|
||||
|
||||
password_field.click()
|
||||
password_field.send_keys(password_value)
|
||||
|
||||
submit_field.click()
|
||||
|
||||
|
||||
driver.get(URL_SORTED_BY_CHEAPEST)
|
||||
@@ -0,0 +1,24 @@
|
||||
"""Find locations in issy-les-moulineaux and keep me informed of new offers."""
|
||||
import os
|
||||
|
||||
from selenium import webdriver
|
||||
|
||||
URL = "https://logement.isep.fr/"
|
||||
URL_SORTED_BY_CHEAPEST = "https://logement.isep.fr/listelogement.php?tri=n|loyer"
|
||||
|
||||
driver = webdriver.Chrome()
|
||||
driver.get(URL)
|
||||
|
||||
id_value, password_value = os.environ['ISEP_ID'], os.environ['ISEP_PASSWORD']
|
||||
id_field, password_field, submit_field = driver.find_elements_by_tag_name('input')
|
||||
|
||||
id_field.click()
|
||||
id_field.send_keys(id_value)
|
||||
|
||||
password_field.click()
|
||||
password_field.send_keys(password_value)
|
||||
|
||||
submit_field.click()
|
||||
|
||||
|
||||
driver.get(URL_SORTED_BY_CHEAPEST)
|
||||
Reference in New Issue
Block a user