Guest User

Untitled

a guest
Jun 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import base64
  2. import datetime
  3. import requests
  4.  
  5. from selenium import webdriver
  6. from selenium.webdriver.chrome.options import Options
  7.  
  8. from print_utils import *
  9.  
  10. #DATETIME
  11. now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
  12. #BASE64
  13. image = open('ddd.jpg', 'rb')
  14. image_read = image.read()
  15. image_64_encode = base64.encodestring(image_read)
  16.  
  17.  
  18. 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)
  19.  
  20. request_headers = {'Host': 'localhost',
  21. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
  22.  
  23. response = requests.post('http://localhost:13600/Servicio.asmx/InsertarMedicion',
  24. data=request_body, headers=request_headers)
  25.  
  26. request = response.request
Add Comment
Please, Sign In to add comment