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
| #!/usr/bin/env python3 | |
| import email | |
| import mimetypes | |
| import smtplib | |
| import os | |
| def generate_email(sender, recipient, subject, body, attachment_path): | |
| message = email.message.EmailMessage() | |
| message["From"] = sender | |
| message["To"] = recipient |
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
| #report_email.py | |
| #!/usr/bin/env python3 | |
| import datetime | |
| import os | |
| from run import catalog_data | |
| from reports import generate_report | |
| from emails import generate_email, send_email | |
| def pdf_body(input_for, desc_dir): |
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
| # reports.py | |
| #!/usr/bin/env python3 | |
| from reportlab.platypus import Paragraph, Spacer, Image, SimpleDocTemplate | |
| from reportlab.lib.styles import getSampleStyleSheet | |
| def generate_report(file, title, add_info): | |
| styles=getSampleStyleSheet() | |
| report=SimpleDocTemplate(file) | |
| report_title=Paragraph(title, styles['h1']) |
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
| #!/usr/bin/env python3 | |
| import socket | |
| import shutil | |
| import psutil | |
| import emails | |
| def check_localhost(): | |
| localhost=socket.gethostbyname('localhost') | |
| return localhost=="127.0.0.1" |
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
| #!/usr/bin/env python3 | |
| import os, requests, json | |
| def catalog_data(url, description_dir): | |
| fruit={} | |
| for item in os.listdir(description_dir): # 문제 | |
| fruit.clear() | |
| filename=os.path.join(description_dir,item) | |
| with open(filename) as f: |
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
| #!/usr/bin/env python3 | |
| import requests, os | |
| # The URL to upload the images | |
| url="http://localhost/upload/" | |
| # To get the username from environment variable | |
| USER = os.getenv('USER') | |
| # The directory which contains all the images. | |
| image_directory='/home/{}/supplier-data/images/'.format(USER) | |
| #Listing all the files in images directory | |
| files=os.listdir(image_directory) |
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
| #!/usr/bin/env python3 | |
| import os, sys | |
| from PIL import Image | |
| user = os.getenv('USER') | |
| image_directory = '/home/{}/supplier-data/images/'.format(user) | |
| for image_name in os.listdir(image_directory): | |
| if not image_name.startswith('.') and 'tiff' in image_name: | |
| image_path = image_directory + image_name |
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
| #!/usr/bin/env python3 | |
| import json | |
| import locale | |
| import sys | |
| from reports import generate as report | |
| from emails import generate as email_generate | |
| from emails import send as email_send | |
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
| class Furniture: | |
| color = "" | |
| material = "" | |
| table = Furniture() | |
| table.color="brown" | |
| table.material="wood" | |
| couch = Furniture() | |
| couch.color="red" |
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
| # define a basic city class | |
| class City: | |
| name = "" | |
| country = "" | |
| elevation = 0 | |
| population = 0 | |
| # create a new instance of the City class and | |
| # define each attribute | |
| city1 = City() |
NewerOlder