티스토리

Just Do It
검색하기

블로그 홈

Just Do It

bigtrue.tistory.com/m

Bigtrue 님의 블로그입니다.

구독자
0
방명록 방문하기

주요 글 목록

  • 폐쇄망 Python pip setting 폐쇄망 Python pip setting 1. 폐쇄망이 아닌곳에서 pakage 설치 2. 설치된 모듈을 리스트로 만든다 pip freeze > requirements.txt 3. 모듈 리스트 다운로드 pip download -r requirements.txt 4. 폐쇄망으로 파일들 이동 & 설치 python -m pip install --no-index --find-links="./" -r requirements.txt python -m pip install --no-index --find-links="./" 설치모듈이름 공감수 0 댓글수 0 2021. 5. 3.
  • Python configparser Module 1. Python configparser Module 이란? .ini or .cfg 속성 저장 2. Python configparser Module Setup pip install configparser 3. Python configparser Module ## main.py import configparser config = configparser.ConfigParser() config.read('config.ini', encoding='utf-8')#한글이 들어갈 경우 인코딩 값 설정 config['defaults']['username'] ## HiHi config['defaults']['username2'] ## HiHi2 ######################################## #.. 공감수 0 댓글수 0 2021. 4. 14.
  • Python filename pattern module Python filename pattern module 1. glob from glob import glob glob('*.exe') ['hihi.exe', 'bigtrue.exe'] glob('*.txt') ['hoho.txt', 'hehe.txt'] glob(r'C:\H*') ['C:\\Hi', 'C:\\He'] 2. fnmatch import fnmatch import os for file in os.listdir('.'): if fnmatch.fnmatch(file, '*.txt'): print(file) 공감수 0 댓글수 0 2021. 1. 22.
  • CentOS7 Python3 Setup 환경 : CentOS7 1. Python Website www.python.org/downloads/ Download Python The official home of the Python Programming Language www.python.org 2. CentOS Python Setup yum install python3 -y 공감수 0 댓글수 0 2021. 1. 20.
  • Python을 활용하여 Kakao 등록 팀원 UUID 값 가지고오기 Python을 활용하여 Kakao 등록 팀원 UUID 값 가지고오기 팀원 등록 Code import json import requests def getFriendsList(): header = {"Authorization": 'Bearer ' + KAKAO_TOKEN} url = "https://kapi.kakao.com/v1/api/talk/friends" #친구 정보 요청 result = json.loads(requests.get(url, headers=header).text) friends_list = result.get("elements") friends_id = [] print(requests.get(url, headers=header).text) print(friends_list) for fr.. 공감수 0 댓글수 0 2021. 1. 14.
  • Python을 활용하여 Kakao MSG Send Me Python을 활용하여 Kakao MSG Send Me Token 값 발급 Code import os import json import requests def sendToMeMessage(text): header = {"Authorization": 'Bearer ' + KAKAO_TOKEN} ## Bearer 한칸띄기 url = "https://kapi.kakao.com/v2/api/talk/memo/default/send" #나에게 보내기 주소 post = { "object_type": "text", "text": text, "link": { "web_url": "https://developers.kakao.com", "mobile_web_url": "https://developers.kakao.com.. 공감수 0 댓글수 0 2021. 1. 14.
  • Python을 활용하여 Slack MSG Send Python을 활용하여 Slack MSG Send Python Slacker module 설치 pip install slacker from slacker import Slacker token = 'xoxo-토큰값' slack = Slacker(token) slack.chat.post_message('#channelName', 'message_descripton') 공감수 0 댓글수 0 2021. 1. 14.
  • Windows 스케줄러 Python Script 사용 Windows 스케줄러 Python Script 사용 Python script를 Windows 기본 스케줄러로 간단히 등록하여 사용 스케줄러옵션 -> 동작 Click Python Path 실행 Python File Name 실행 Python File Path 끝 공감수 0 댓글수 0 2021. 1. 14.
  • KakaoTalk Proxy Server 구축 환경 Server : 구름IDE OS : Ubuntu 16.04 LTS Proxy Server : Squid CMD sudo apt-get update sudo apt-get upgrade sudo apt-get install squid3 sudo vi /etc/squid/squid.conf #http_access allow manager localhost < -- 주석 #http_access deny manger < -- 주석 http_access allow all < -- 추가 http_port 8080 < -- defalult 3128 에서 ex)8080 change sudo service squid restart 공감수 0 댓글수 0 2021. 1. 14.
  • Python Pyinstaller Control Python Pyinstaller Control Option -w : noconsole -F : onefile pyinstaller -w -F 파일명.py etc import가 없다고하면 아래 —hidden-import=pkg명 추가 pyinstaller -w -F --hidden-import=pkg_resources.py2_warn "Deploy_Control[gui].py" spec file 안에 import sys sys.setrecursionlimit(5000) 공감수 0 댓글수 0 2021. 1. 14.
  • Python package environment settings Python package environment settings 설치되어있는 패키지 req.txt 에 저장 pip freeze > req.txt req.txt에 지정된 패키지를 타겟환경에 설치 pip install -r req.txt 패키지에 대한 의존성으로 설치불가 패키지는 수동설치 필요 공감수 0 댓글수 0 2021. 1. 14.
  • Get it from Python Parameter Jenkins Get it from Python Parameter Jenkins import os Hi = os.getenv(&#39;Hi&#39;) print(Hi) 공감수 0 댓글수 0 2021. 1. 14.
  • Python File Searching Python File Searching import os import subprocess def search(dirname): try: filenames = os.listdir(dirname) for filename in filenames: full_filename = os.path.join(dirname, filename) if os.path.isdir(full_filename): search(full_filename) else: ext = os.path.splitext(full_filename)[-1] if ext == &#39;.tar&#39;: # print(full_filename) ## full name file_pathss = full_filename.rstrip(&#39;.tar&#39;).. 공감수 0 댓글수 0 2021. 1. 14.
  • Python Excel Control Python Excel Control from openpyxl import Workbook from openpyxl.styles.borders import Border, Side from openpyxl.styles import PatternFill, Color, Font, Alignment ## 테두리 지정 box = Border(left=Side(border_style="thin", color=&#39;FF000000&#39;), right=Side(border_style="thin", color=&#39;FF000000&#39;), top=Side(border_style="thin", color=&#39;FF000000&#39;), bottom=Side(border_style="thin", colo.. 공감수 0 댓글수 0 2021. 1. 14.
  • Python 개발환경 Setting Python 개발환경 Setting 비주얼 스튜디오 코드(Visual Studio Code) 설치 아래의 경로에서 비주얼 스튜디오 코드(Visual Studio Code)를 다운로드 받아 설치 한다. https://code.visualstudio.com/ 파이썬(Python) 설치 아래의 경로에서 파이썬(3.X)를 설치 한다. https://www.python.org/downloads/ VSCode Extension Setting 비주얼 스튜디오 코드(Visual Studio Code)에 파이썬(Python) 확장(Extension) 설치 1) 메뉴 > 보기 > 확장 2) 검색어에 python 입력 3) Python(Don Jayamanne) 설치 공감수 0 댓글수 0 2021. 1. 14.
  • Python PyAutoGUI Control Python PyAutoGUI Control Python PyAutoGUI install pip install pyautogui https://pypi.org/project/PyAutoGUI/ Python PyAutoGUI Keyboard and Mousee Control import pyautogui # Move the mouse to the x, y coordinates 100, 150. pyautogui.moveTo(100, 150) # Click the mouse at its current location. pyautogui.click() # Double click the mouse at the pyautogui.doubleClick() # Click the mouse at the x, y coo.. 공감수 0 댓글수 0 2021. 1. 14.
  • Python PowerShell Python PowerShell import subprocess subprocess.call(["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "ls"]) 공감수 0 댓글수 0 2021. 1. 14.
  • Real-time Python Jenkins Build Status Check Real-time Python Jenkins Build Status Check import jenkins ## Jenkins Info Jserver = jenkins.Jenkins(&#39;url&#39;, username=&#39;admin&#39;, password=&#39;admin&#39;) while True: lastBuild = Jserver.get_job_info(&#39;JobName&#39;)[&#39;lastBuild&#39;][&#39;number&#39;] url = Jserver.get_build_info(&#39;JobName&#39;, lastBuild) if url[&#39;building&#39;] == True: print(&#39;Jenkins Job Building .. 공감수 0 댓글수 0 2021. 1. 14.
  • Python GitLab Module Install Python GitLab Module Install pip install python-gitlab GitLab Login import gitlab gl = gitlab.Gitlab(&#39;URL&#39;, private_token=&#39;Token&#39;) Get the list of users users = gl.users.list() users = gl.users.list(search=&#39;foo&#39;) # by ID user = gl.users.get(user_id) # by username user = gl.users.list(username=&#39;root&#39;)[0] Create a user user = gl.users.create({&#39;email&#39;: &#39;t.. 공감수 0 댓글수 0 2021. 1. 14.
  • Python Url Monitor Python Url Monitor import requests import time from datetime import datetime url = (&#39;http://www.interpark.com&#39;,) # tuple while True: for site in url: with requests.Session() as s: r = s.get(site) if r.status_code == 200: # r.status_code : response status print(&#39;%s is ok : Response Status : %d&#39; %(site, r.status_code)) print(&#39;%s is ok : site allive&#39; %(site)) else: print(&#3.. 공감수 0 댓글수 0 2021. 1. 13.
  • Python System Info Python Linux System Info import os import time unumber = os.getuid() pnumber = os.getpid() where = os.getcwd() what = os.uname() used = os.times() now = time.time() means = time.ctime(now) print ("User number",unumber) print ("Process ID",pnumber) print ("Current Directory",where) print ("System information",what) print ("System information",used) print ("\nTime is now",now) print ("Which interp.. 공감수 0 댓글수 0 2021. 1. 13.
  • Python Jenkins Module Install Python System Info Python Jenkins Module Install pip install python-jenkins Jenkins Login server = jenkins.Jenkins(&#39;URL&#39;, username=&#39;ID&#39;, password=&#39;PASSWD&#39;) Working with Jenkins Jobs server.create\_job(&#39;empty&#39;, jenkins.EMPTY\_CONFIG\_XML) jobs = server.get\_jobs() my\_job = server.get\_job\_config(&#39;cool-job&#39;) server.build\_job(&#39;empty&#39;) server.disabl.. 공감수 0 댓글수 0 2021. 1. 13.
  • Python E-Mail Send Python E-Mail Send To_User = &#39;ToUser@email.com&#39; From_User = &#39;SendUser@email.com&#39; Msg_Subject = &#39;Subject&#39; Msg_Description = &#39;Description&#39; serverName = &#39;imail2.targetServerName.com&#39; msg = MIMEMultipart() # msg = MIMEText(Msg_Description) ## 본문 msg[&#39;To&#39;] = To_User msg[&#39;From&#39;] = From_User msg[&#39;Subject&#39;] = Msg_Subject ##제목 msg.attach(MIM.. 공감수 0 댓글수 0 2021. 1. 13.
  • Python Slack Msg Send Python Slack Msg Send import requests def slackSendMsg(botMsg): # webhook url url = "webhook url" payload = { "text": botMsg } requests.post(url, json=payload) ``` 공감수 0 댓글수 0 2021. 1. 13.
  • python rundeck module install python rundeck module install pip install rundeckrun rundeck login from rundeck.client import Rundeck rd = Rundeck(server=&#39;ip&#39;, protocol=&#39;http&#39;, port=4440, api_token=&#39;token&#39;) project List pl = rd.list_projects() Job LIst jl = rd.list_jobs(&#39;dockerDeploy&#39;) Job Run rd.run_job(&#39;a6e1e0f7-ad32-4b93-ba2c-9387be06a146&#39;, argString={&#39;from&#39;: &#39;RundeckRun&#.. 공감수 0 댓글수 0 2021. 1. 13.
  • Python Jira Module Install Python Jira Module Install pip install atlassian-python-api https://pypi.org/project/atlassian-python-api/ Jira Login from atlassian import Jira jira = Jira( url=&#39;http://localhost:8080&#39;, username=&#39;admin&#39;, password=&#39;admin&#39;) Get issues from jql search result with all related fields jql_request = &#39;project = DEMO AND status NOT IN (Closed, Resolved) ORDER BY issuekey&#39;.. 공감수 0 댓글수 0 2021. 1. 13.
  • Python Hosts Control python Hosts module install pip install python-hosts Hosts path setting from python_hosts import Hosts, HostsEntry hosts = Hosts(path=&#39;C:\\hosts3&#39;) Hosts add hosts.add([HostsEntry(entry_type=&#39;ipv4&#39;, address=&#39;1.2.3.4&#39;, names=[&#39;www.example.com&#39;, &#39;#example&#39;])]) hosts.write() Hosts remove hosts.remove_all_matching(address=&#39;1.2.3.4&#39;) hosts.write() Host .. 공감수 0 댓글수 0 2021. 1. 13.
    문의안내
    • 티스토리
    • 로그인
    • 고객센터

    티스토리는 카카오에서 사랑을 담아 만듭니다.

    © Kakao Corp.