Search results

  1. fukurou

    🐍 python python grimoire

    teillio whatapp bot
  2. fukurou

    🐍 python python grimoire

    python : read gmail inbox programmatically : ORG_EMAIL = "@gmail.com" FROM_EMAIL = "your_email" + ORG_EMAIL FROM_PWD = "your-password" SMTP_SERVER = "imap.gmail.com" SMTP_PORT = 993 def read_email_from_gmail(): try: mail = imaplib.IMAP4_SSL(SMTP_SERVER)...
  3. fukurou

    🐍 python python grimoire

    escape unescape html : import html str1 = "&quot;eating burgers, without no honey mustard&quot;" print(html.unescape(str1)) # "eating burgers, without no honey mustard" explicit type : str2: str = "" explicit function : def isThin(BMI: int) -> bool: return BMI < 17
  4. fukurou

    🐍 python python grimoire

    import requests # example 1 API with parameter (yoda api): txt = "i like to eat hummus" response = requests.get(url=f"https://api.funtranslations.com/translate/yoda.json?text={txt}") # ISS satelite response.raise_for_status() print(response.status_code) data = response.json() # treat as...
  5. fukurou

    🐍 python python grimoire

    example python API with Tkinter UI from tkinter import * import requests def get_quote(): response = requests.get(url="https://api.kanye.rest/") quote = response.json()["quote"] canvas.itemconfig(quote_text, text=quote) window = Tk() window.title("Kanye Says...")...
  6. fukurou

    🐍 python python grimoire

    python API import requests # url=endpoint response = requests.get(url="http://api.open-notify.org/iss-now.json") #ISS satelite # response codes : # httpstatuses.com # 1xx: hold on # 2xx: here you go # 3xx: go away, no permission # 4xx: you screwed up # 5xx: server screwed up...
  7. fukurou

    🐍 python python grimoire

    scedule run the code online : pythonanywhere.com and create an account 1 files, upload the pythone project files respective of the directories set up 2 consoles, bash (or click the main.py, bash to just test), type : python3 main.py if you see the smtplib.SMTPAuthenticationError : go to the...
  8. fukurou

    🐍 python python grimoire

    # auto sender # csv example : # name,email,year,month,day # Test,[email protected],1961,12,21 from datetime import datetime import pandas import random import smtplib MY_EMAIL = "YOUR EMAIL" MY_PASSWORD = "YOUR PASSWORD" today = datetime.now() today_tuple = (today.month, today.day) # tuple as...
  9. fukurou

    🐍 python python grimoire

    python sending emails programmatically set up gmail : manage acc, security, set use phone to sign in -> off set 2 step verification -> off less secure apps -> on set up yahoo mail account info, acc security generate new app pass other app, custom name: python code, generate copy the...
  10. fukurou

    🐍 python python grimoire

    tkinter timer manipulations inside a function : global current_card, flip_timer window.after_cancel(flip_timer) flip_timer = window.after(3000, func=flip_card)
  11. fukurou

    🐍 python python grimoire

    tkinter image button : from tkinter import * check_image = PhotoImage(file="images/right.png") known_button = Button(image=check_image, highlightthickness=0, command=is_known) known_button.grid(row=1, column=1 pandas csv to dictionary type (.to_dict()) parameter list ...
  12. fukurou

    🐍 python python grimoire

    JSON format : import json def save_json(): website = "supremegents.club" email = "[email protected]" password = "qwerty" new_data = { website: { "email": email, "password": password } } with open("data.json", "w") as data_file...
  13. fukurou

    🐍 python python grimoire

    # raise custom error h = float(input("height")) if h > 3: raise ValueError("shingeki kyoujin")
  14. fukurou

    🐍 python python grimoire

    try try code snippet except err_type code to run on fail or key word 'pass' to not do anything else code to run on no err finally runs anyways try: file = open("non_existing_file.txt") except: print("Ha Ha file not fount err") file = open("non_existing_file.txt", "w") # create the...
  15. fukurou

    🐍 python python grimoire

    clipboard management import pyperclip # https://pypi.org/project/pyperclip/ pyperclip.copy(str) # copy str to the clipboard
  16. fukurou

    🐍 python python grimoire

    reverse split list into a string str1.join(list) # "" to join without buffer string between elements focus on entry : e1 = Entry(width=35) e1.focus() e1.insert(0, "text") # insert text to entry, use END for the last index e1.delete(0,END) # clear entry
  17. fukurou

    🐍 python python grimoire

    tkinter timer example import math from tkinter import * # ---------------------------- CONSTANTS ------------------------------- # # color pallets hex codes : colorhunt.co PINK = "#e2979c" RED = "#e7305b" GREEN = "#9bdeac" YELLOW = "#f7f5dd" FONT_NAME = "Courier" WORK_MIN = 25...
  18. fukurou

    🐍 python python grimoire

    TKinter Layout managers place layout manager : from tkinter import * # window GUI for the program window = Tk() window.title("GUI test") window.minsize(width=500, height=300) # add a label : lbl1 = Label(text="label1", font=("Times", 24, "bold")) lbl1.place(x=0, y=0) #precise layout manager...
  19. fukurou

    [MEDIA]

  20. fukurou

    ⚡ arduino PID formula

    PID = P + I + D err = setpoint-processValue P = K(err) reset = reset + k/tau_i*err I = reset //once err changes direction or zero reset =0 D = K/tau_i*(error-lastError); lastErr = err; K : gain : this is twicked K/tau_i : can also be twicled for optimal performance tau_i : second per repeat...
Top