Sending emails using outlook with Python - Overcoming Azure Information Protection Classifications - python

I am using win32com to create emails, but with Azure Information Protection now enabled how do I select the classification from within python.
I have 2 solutions so far: turn off AIP or manually select the classification, is there any way to automate it from the script?
Thanks!

I suppose you are running the python script to create emails on the azure web app. As I know , azure web app runs in a sandbox. I searched the General Sandbox Restrictions from this doc and found the restrictions of COM servers as below:
Windows Servers have a bunch of COM servers configured and available
for consumption by default; however the sandbox prevents access to all
out-of-proc COM servers. For example, a sandboxed application cannot
call into WMI, or into MSIServer.
So, in fact, we could use Azure SendGrid Service to post emails instead of win32corn.
This is Azure SendGrid Python SDK and Azure SendGrid pricing rules.
Hope it helps you.

Related

How to connect to sharepoint from a python script after Microsoft deprecates basic authentication and forces MFA?

I currently have a script in python using shareplum library which connects to our sharepoint to upload a specific file periodically. Currenly it's authenticating via an app password.
Recently I just saw this Microsoft notice that they will disable basic authentication including app passwords and they will be forcing MFA from 03/31/2023.
I've been looking for alternatives to keep using this kind of automated scripts to work with sharepoint files but I couldn't find anything...
What do you suggest?

Creating a desktop Python app with Firebase, how do I include the private key?

I'm trying to build a desktop application that is built with python and pyqt5. I want to send it to users with their own login details, but I am not totally sure what to do with the private key. Up until now, I've had to do
export GOOGLE_APPLICATION_CREDENTIALS=[path to private key json]
or for windows
set GOOGLE_APPLICATION_CREDENTIALS=[path to private key json]
Obviously I don't want to give out the private key. Is it ok to store it in the program, or is there a special safe way to do that? I'm using pyinstaller to package everything.
The only SDK Firebase provides for use wit Python is a so-called Admin SDK. As the documentation on [setting up the Admin SDK] says:
The Admin SDK lets you interact with Firebase from privileged environments
So this SDK is not suitable for developing applications for your regular users, as the credentials it requires grant the user full administrative access to your Firebase project.
There is no official Firebase SDK for developing Python applications for regular clients, so your options are limited to:
Using the REST APIs for the various Firebase services, and writing your own client-side Python code against that.
Using a third-party API, such as Pyrebase that supports both client-side and administrative access.

Azure IoT cloud-to-device messaging via Rails?

I'm currently building an API in Rails to control devices registered with an Azure IoT Hub.
Now, in the Azure documentation, I only see Python/Node/.Net guides to control the end devices.
I require Rails for certain libraries, and hence used it to build my API. But now I've hit this road block.
Is there no way I can send cloud-to-device messages? I don't see any official Rails support. I only require c2d messaging.
Edit : The only other way I can think of with my limited knowledge is to deploy a small Python/Flask app on the same server and have my Rails code make HTTP requests to it. Is this a bad approach?
I do recommend to use the Azure HttpTrigger Function for your solutions as an API integrator/mediator.

Trying to use python on a server

I am using pythonanywhere.com and trying to run an app that I made for twitter that uses tweepy but it keeps saying connection refused or failed to send request. Is there any way to run a python app online easily that sends requests?
Pythonanywhere requires a premium account for web access.
You can create a limited account with one web app at your-username.pythonanywhere.com, restricted Internet access from your apps, low CPU/bandwidth. It works and it's a great way to get started!
Get a premium account:
$5/month
Run your Python code in the cloud from one web app and the console
A Python IDE in your browser with unlimited Python/bash consoles
One web app with free SSL at
your-username.pythonanywhere.com
Enough power to run a typical 50,000 hit/day website.
(more info)
3,000 CPU-seconds per day
(more info)
512MB disk space
That said, I'd just set it up locally if its for personal use and go from there.
You will need a server that has a public IP.
You have a few options here:
You can use a platform-as-a-service provider like Heroku or AWS Elastic Beanstalk.
You can get a server online on AWS, install your dependencies and use it instead.
As long as you keep your usage low, you can stay withing the free quotas for these services.

Is it possible to use SAS to connect to Microsoft Azure in Python?

Currently i am working on a project which submits data to the Microsoft Azure platform.
I'm using a service bus which contains various queues and subscriptions.
Since i am developing for the Raspberry Pi i decided to use the Azure SDK for Python found on GitHub.
To make sure not every device can delete messages i want to have some policies. Microsoft Azure supports Shared Access Signature Authentication (SAS) and Access Control Service (ACS).
Yet i haven't found a way to use SAS with the Python library.
I am fairly new to using Python so it could be that i am just looking over it, but some help or directions would be appreciated.

Categories