일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- 분류 결과표
- IN
- elbow method
- append()
- DataFrame
- pandas
- DataAccess
- wcss
- sklearn
- matplotlib
- insert()
- 최솟값
- Python
- function
- Dictionary
- 최댓값
- 반복문
- 덴드로그램
- string
- del
- numpy
- Machine Learning
- dendrogram
- nan
- len()
- analizer
- list
- data
- hierarchical_clustering
- count()
- Today
- Total
목록Python/Flask (17)
개발공부

Postman 사용 이유 프론트엔드를 배제하고, 서버 프로그램이 들어온 API 요청에 대해서 제대로 동작하는지 확인하기 위함입니다. 요청에 대한 결과는 하단의 Response로 들어오게 됩니다. Collection 내에 저장하거나 json 파일로 다운로드 할 수 있습니다. 설치하기 https://www.postman.com/downloads/ Download Postman | Get Started for Free Try Postman for free! Join 20 million developers who rely on Postman, the collaboration platform for API development. Create better APIs—faster. www.postman.com 설치후 ..

Flask에서 Resource 클래스를 이용해 API 서버를 개발하는 틀의 예시는 아래와 같다. app.py from flask import Flask from flask_restful import Api from resources.recipe import RecipeListResource from resources.recipe_info import RecipeResource app = Flask(__name__) api = Api(app) # 경로와 리소스(API 코드)를 연결한다. api.add_resource(RecipeListResource, '/recipes') api.add_resource(RecipeResource, '/recipes/') if __name__ == '__main__' : a..

import mysql.connector def get_connection() : connection = mysql.connector.connect( host = '호스트이름', database = 'DB이름', user = 'USER명', password = '비밀번호', ) return connection try : # 데이터 Delete # 1. DB에 연결 connection = get_connection() # 2. 쿼리문 만들기 query = '''delete from mysql_table where col = val;''' # 3. 커서를 가져온다. cursor = connection.cursor() # 4. 쿼리문을 커서를 이용해서 실행한다. cursor.execute(query) # 5...

import mysql.connector def get_connection() : connection = mysql.connector.connect( host = '호스트이름', database = 'DB이름', user = 'USER명', password = '비밀번호', ) return connection try : # 데이터 Update # 1. DB에 연결 connection = get_connection() # 2. 쿼리문 만들기 query = '''Update mysql_table set col1 = val1', col2 = val2, ... where col = val;''' # 3. 커서를 가져온다. cursor = connection.cursor() # 4. 쿼리문을 커서를 이용해서 실행..

import mysql.connector def get_connection() : connection = mysql.connector.connect( host = '호스트이름', database = 'DB이름', user = 'USER명', password = '비밀번호', ) return connection try : # 데이터 select # 1. DB에 연결 connection = get_connection() # 2. 쿼리문 만들기 query = '''select * from mysql_table;''' # 3. 커서를 가져온다. # select의 경우 dictionary = True로 설정한다. cursor = connection.cursor(dictionary = True) # 4. 쿼리문을 ..

import mysql.connector def get_connection() : connection = mysql.connector.connect( host = '호스트이름', database = 'DB이름', user = 'USER명', password = '비밀번호', ) return connection try : # 데이터 insert # 1. DB에 연결 connection = get_connection() # 2. 쿼리문 만들기 query = '''insert into mysql_table (col1, col2, ...) values (value1, value2, ...);''' # 3. 커서를 가져온다. cursor = connection.cursor() # 4. 쿼리문을 커서를 이용해서 실..

API (Application Programming interface) 란 ? - 응용 프로그램에서 사용할 수 있도록, 운영 체제나 프로그래밍 언어가 제공하는 기능을 제어할 수 있게 만든 인터페이스 - API를 통해 소스 및 DB에는 접근하지 못하게 하고 해당 프로그램을 사용할 수 있도록 기능을 제공하게 하는 것이다. REST (Representational State Transfer) 란 ? - 서버나 서비스에 존재하는 모든 자원(이미지, 동영상, DB자원)에 고유한 URI를 부여해 활용하는 것이다. - 자원을 정의하고 자원에 대한 주소를 지정하는 방법론을 의미한다. 통신을 위한 REST 구성 - 자원(Resource) : http://service.com/user 라는 형태의 URI - 행위(Meth..