일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Linux
- numpy
- Container
- Python
- KAKAO
- evaluation
- CUDA
- Converting
- Flask
- docker
- TORCH
- Mac
- pytorch
- list
- GitLab
- Laravel
- enV
- pandas
- format
- PostgreSQL
- Paper
- AI
- LLM
- Windows
- DB
- judge
- Database
- file
- git
- Package
- Today
- Total
목록Request (2)
Daily Develope
"requests" 모듈을 사용하는 경우 Content-Type을 명시 혹은 생략하는 2가지 방법이있다. 만약 호출하려는 api 에서 Content-Type(~Header)을 검사하는 경우라면 전자(Content-Type 명시)의 방법을, 아니라면 후자의 방법을 사용하면된다. 방법1) Content-Type 명시 : Header에서 Content-Type으로 MultipartEncoder로 생성해 boundary가 추가된 content-type을 받아 사용한다. (pre-cond. requests_toolbelt 설치) import requests from requests_toolbelt import MultipartEncoder _data = MultipartEncoder(fields=[("tfile"..
flask에서 데이터 읽기사용자가 데이터를 싣어보내는 방법이 다양하기에, 규격(유형)에 맞는 데이터 읽기 방법을 구현해야한다.샘플코드- Get 요청 : request.args 로 데이터 전달- Post 요청 : request.form 으로 데이터 전달- 입력 유형(format)에 따라 데이터 구분 가능 (request.content_type)from flask import request#...@sample.route('/', methods=['GET', 'POST'])def sampleAPI():# ... contentType = request.content_type # 또는 contentType = request.headers.get('Content-Type') args = None ..