Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

rest api save file python

import requests
import base64

pat = ""
authorization = str(base64.b64encode(bytes(':'+pat, 'ascii')), 'ascii')
url="https://auditservice.dev.azure.com/{org}/_apis/audit/downloadlog?  
format=csv&startTime=2020-07-01T00.00.00&endTime=2020-10-15T16.00.00&api-version=6.1-   
preview.1"

headers = {
 'Accept': 'application/json',
 'Authorization': 'Basic '+authorization
}

response = requests.get(url, headers=headers)

with open("/Users/username/logs/logs.csv", "w") as text_file:
    text_file.write(response.content)
Comment

PREVIOUS NEXT
Code Example
Python :: convert to category data type 
Python :: the most effective search methods in python with example 
Python :: ValueError: y_true and y_pred contain different number of classes 6, 2. Please provide the true labels explicitly through the labels argument. Classes found in y_true: [0 1 2 3 4 5] 
Python :: how can i get the n values by space separated with condition in python 
Python :: dimension reduction using pca 
Python :: what is PaasLib 
Python :: python loop take out element backwardly 
Python :: raspian image with preinstalled python3 
Python :: traint test split on column id 
Python :: Customizing plot with axes object 
Python :: patoolib extract password-protected archives 
Python :: matplotlib boxplot fill box with pattern 
Python :: read sharepoint list using python 
Python :: biopython parse fasta 
Python :: use decorator more than once 
Python :: pyqt set widget size 
Python :: Closing small holes in the binary image with opencv 
Python :: hoow to print python 
Python :: index is datetime and i want the row number 
Python :: python or in if statement 
Python :: multi line cooment in python 
Python :: schedule a function python inside tkinter loop 
Python :: returns the dataframe with the modified Title column in which the updated groupings are reflected. 
Python :: tuple parameter function python is None 
Python :: explorer gives new window 
Python :: python numpy find local minima 
Python :: Sorts this RDD by the given keyfunc 
Python :: pygame rect follower 
Python :: how to pairwise permute in python 
Python :: r value on poly fit python 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =