How to measure download speed and progress using requests?

see here: Python progress bar and downloads i think the code would be something like this, it should show the average speed since start as bytes per second: import requests import sys import time def downloadFile(url, directory) : localFilename = url.split(“https://stackoverflow.com/”)[-1] with open(directory + “https://stackoverflow.com/” + localFilename, ‘wb’) as f: start = time.clock() r = … Read more

Sending SOAP request using Python Requests

It is indeed possible. Here is an example calling the Weather SOAP Service using plain requests lib: import requests url=”http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL” #headers = {‘content-type’: ‘application/soap+xml’} headers = {‘content-type’: ‘text/xml’} body = “””<?xml version=”1.0″ encoding=”UTF-8″?> <SOAP-ENV:Envelope xmlns:ns0=”http://ws.cdyne.com/WeatherWS/” xmlns:ns1=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”> <SOAP-ENV:Header/> <ns1:Body><ns0:GetWeatherInformation/></ns1:Body> </SOAP-ENV:Envelope>””” response = requests.post(url,data=body,headers=headers) print response.content Some notes: The headers are important. Most SOAP requests … Read more