Skip to content

Instantly share code, notes, and snippets.

@nitrocode
nitrocode / upload-file-rest-endpoint-requests.py
Last active December 5, 2017 03:58
Uploads file with a rest end point using python's request module
#!/usr/bin/env python
import requests
import os
def upload_file(url, file_loc, cookies=None, headers=None,
file_type='application/vnd.ms-excel'):
"""Upload a file using an end point using requests posting of
a multipart encoded file
@dariodiaz
dariodiaz / highlight_sel_element.py
Created July 13, 2012 12:16 — forked from marciomazza/highlight_sel_element.py
python: Highlights a Selenium Webdriver element
import time
def highlight(element):
"""Highlights (blinks) a Selenium Webdriver element"""
driver = element._parent
def apply_style(s):
driver.execute_script("arguments[0].setAttribute('style', arguments[1]);",
element, s)
original_style = element.get_attribute('style')
apply_style("background: yellow; border: 2px solid red;")