Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import base64
- import datetime
- import requests
- from selenium import webdriver
- from selenium.webdriver.chrome.options import Options
- from print_utils import *
- #DATETIME
- now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
- #BASE64
- image = open('ddd.jpg', 'rb')
- image_read = image.read()
- image_64_encode = base64.encodestring(image_read)
- request_body = 'IdUsuario={id}&Temperatura={temp}&Humedad={hum}&Imagen={img}&fecha={fech}'.format(id='1', temp='20', hum='18', img=image_64_encode, fech=now)
- request_headers = {'Host': 'localhost',
- 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
- response = requests.post('http://localhost:13600/Servicio.asmx/InsertarMedicion',
- data=request_body, headers=request_headers)
- request = response.request
Add Comment
Please, Sign In to add comment