본문 바로가기

Python/실습

(12)
[Slack API] Slack Bot 만들고 Slack 메세지 보내기 / Scopes / slacker 기존에 Bot user을 추가하는 방식은 deprecated되었고, token scope을 지정하는 방식으로 바뀌었다. 그런데 공식 api tutorial도 업데이트가 잘 안되있어서 직접 정리해보았다. Slack 회원가입 후 새로운 workspace 만들기 https://slack.com/intl/en-kr/ Where work happens Slack is where work flows. It's where the people you need, the information you share, and the tools you use come together to get things done. slack.com Slack API에서 새로운 app만들기 https://api.slack.com/ Where w..
[Spotify Web API] 특정 artist의 top 10 playlist 가져오기 / 파이썬 spotipy 라이브러리 사용 Spotify란 전세계 최대의 음원 스트리밍 서비스 그리고 spotify의 web api를 통해서 artists, tracks, playlists 등 유용한 여러 정보를 받을 수 있다. 단, 한국에선 막혀있기 때문에 브라우저의 VPN 우회기능으로 회원가입을 한 후 사용할 수 있다. api를 이용하기 위해서는 로그인 후 dashboard에서 새로운 app을 생성한 후 client id와 client secret을 발급받아야 한다. https://developer.spotify.com/documentation/web-api/ Web API | Spotify for Developers Simply put, your app receives Spotify content through the Spotify Web ..
[YTS YIFY movie API] 영화 다운로드 횟수 TOP 10 / 파이썬 www.yts.mx/api API Documentation - YTS YIFY Official YTS YIFY API documentation. YTS offers free API - an easy way to access the YIFY movies details. yts.mx 코드 # 파이썬 import requests import json api_url = 'https://yts.mx/api/v2/list_movies.json?sort_by=download_count&limit=10' data = requests.get(api_url) json_data = json.loads(data.text) for d in json_data['data']['movies']: print(d['title_long'..
[웹크롤링] 교보문고 베스트셀러 Top20 크롤링하기 requests, beautifulsoup4 설치 $ pip install requests beautifulsoup4 코드 from urllib.request import urlopen from bs4 import BeautifulSoup as bs html = urlopen("http://www.kyobobook.co.kr/bestSellerNew/bestseller.laf") # 교보문고 베스트셀러 bsObject = bs(html, "html.parser") week_standard = bsObject.find('h4', {'class':'title_best_basic'}).find('small').text # 집계기준 날짜 bestseller_contents = bsObject.find('ul',..
[Django 유튜브 동영상 업로드 서비스] 나의 첫번째 DjangoTube 프로젝트(계속 업데이트 중...2020/04/28) 실습 Github 주소 https://github.com/JisunParkRea/my_djangotube JisunParkRea/my_djangotube Simple video service which can upload youtube videos using django - JisunParkRea/my_djangotube github.com Heroku 배포 주소 -> http://djangotube.herokuapp.com/video/ 수정한 부분 - 나의 첫번째 장고튜브 프로젝트[참고] 기반으로 계속 수정중 - templates 파일들 첫문장인 {% load staticfiles %} 삭제 - reverse()를 삭제하고 redirect()만 사용 - urls 설정에 레거시한 표현방법 수정 예) r'..
[REST API: requests] 네이버 개발자 등록 / Naver Papago API / 번역 API 네이버 개발자에서 어플리케이션 등록 Papago 번역 API 추가 비로그인 오픈 API 서비스 환경: WEB설정 -> http://localhost.com 기본 예제 https://developers.naver.com/docs/papago/papago-nmt-example-code.md#python https://developers.naver.com/docs/papago/papago-nmt-example-code.md#python developers.naver.com import os import sys import urllib.request client_id = "YOUR_CLIENT_ID" # 개발자센터에서 발급받은 Client ID 값 client_secret = "YOUR_CLIENT_SECRET..
[웹크롤링: bs4, requests] 네이버 날씨 미세먼지 가져오기 / 네이버 웹툰 제목 가져오기 / 네이버 웹툰 썸네일 가져오기 작업 환경 구성 > mkdir webCrawling > cd webCrawling > python -m venv myvenv > myvenv\Scripts\activate > python -m pip install --upgrade pip > pip install requests > pip install BeautifulSoup4 네이버 날씨 미세먼지 가져오기 # 네이버 날씨에서 미세먼지 지수 가져오기 from bs4 import BeautifulSoup as bs from pprint import pprint import requests html = requests.get('https://search.naver.com/search.naver?sm=top_hty&fbm=0&ie=utf8&query=%EB..
[django 연습] 나의 첫 번째 Django 프로젝트 / Django Girls(장고 걸스) Tutorial Django Girls Tutorial https://tutorial.djangogirls.org/ko/django_start_project/ 나의 첫 번째 Django 프로젝트! · Django Girls Tutorial 맥 OS과 리눅스 콘솔에서는 다음과 같이 명령을 실행해야해요. 명령어 끝에 .(점, 마침표)을 입력하는 것을 잊지마세요. : command-line (myvenv) ~/djangogirls$ django-admin startproject mysite . 점 .은 현재 디렉토리에 장고를 설치하라고 스크립트에 알려주기 때문에 중요해요. (축약된 표시입니다) Note 위 명령을 입력할 때 django-admin로 시작하는 부분만 입력하세요. 여기에 보이는 (m tutorial.djangog..