Skip to content

Instantly share code, notes, and snippets.

View nsna's full-sized avatar
🤔
...

Brad Russell nsna

🤔
...
View GitHub Profile
def get_token() -> dict | None:
"""
Begins OAuth workflow to retrieve a bearer token.
if successful, returns {
'Authorization': "Bearer <access_token>"
}
else None
"""
# https://api.sharefile.com/gettingstarted/oauth2
tenant_id = os.getenv('M365_TENANT_ID')
url = f"https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token"
data = {
'client_id': os.getenv("M365_APP_ID"),
'scope': os.getenv("M365_SCOPE"),
'client_secret': os.getenv("M365_APP_SECRET"),
'grant_type': 'client_credentials'
}
result = requests.post(url, data=data)
.editor-group-watermark > .letterpress {
background-image: url("https://raw.githubusercontent.com/Aikoyori/ProgrammingVTuberLogos/main/VSCode/VSCode.png") !important;
opacity: .75;
}
@nsna
nsna / combine-csv.ps1
Last active June 23, 2021 05:00
Combine csv files - Powershell
# Load Excel powershell module; install if it doesn't exist
if (Get-Module -ListAvailable -Name ImportExcel) {
Write-Host "Excel module check passes"
}
else {
try {
Install-Module -Name ImportExcel -AllowClobber -Confirm:$False -Force
}
catch [Exception] {
$_.message