python receive push notifications like a browser - python

Is there a way to make python receive a web push notification like a browser ?
I have a web page with Firebase cloud messaging subscription service ( FCM JavaScript client )
I need to somehow receive notifications on my python program running on windows pc
one idea was to opening a selenium chrome browser and receive notifications trough that but I didn't find a way to receive data from notifications , also I'm trying to log all windows notifications with Auto Hotkey and read the log file for my purpose but neither if this methods are time and resource reasonable
so is there any way to achieve this purpose ?

Related

How to re-request on the same route while Flask is running?

So I am trying to have program that uses browser automation. I will be using the Selenium package from Python. This will all be in a Flask route in system A.
Essentially I will be doing browser automated commands through Selenium, then sending an output to system B via a get request. I then want to wait for system B to verify that the request sent is valid. Then system B will send a request back to the same endpoint on system A to finish the Selenium process.
Remember I CANNOT use redirects because I have to stay within the same Flask route and Selenium process. I cannot simply just call another function because system A is waiting on system B to send back a request to finish the Selenium process.
Is there a way to do this?

Telegram web app won't open on mobile devices

I'm writing a Telegram bot in Python that sends back from a /start command a button that when pressed, it should open a web app. Nothing so complicated so far. The problem that I'm having is that the web app ( a simple HTML file ) opens fine on the desktop version of Telegram ( Telegram web ) but it won't open on a mobile device. I tried more than one device. I must add that a demo Telegram web app ( Durger King ) runs fine in every mobile device and the desktop version.
The web app is just an HTML file hosted in an HTTPS server. In my case, this server runs on the same computer together with the Telegram bot. That shouldn't be a problem but I mention it just in case.
If I send the url as a message to some user in Telegram, the page can be opened by Telegram on its embedded browser ( or any other for that matter ) perfectly well.
I tested different python bot libraries and different HTTPS servers. The only thing that can be a problem is de SSL certificate. I generate certificates using Letsencrypt - Certbot. I have used it for a long time with no troubles at all. The certificates are perfectly legal.
What can be the problem ? I'm open to suggestions. Thanks!!
As mentioned here connect your device to PC/Laptop and debug it from chrome://inspect/#devices. Then navigate to the console tab and see if any error has occurred.

how to build notification pop up system from cloud to local computer

I'm trying to build a notification system that would be triggered initially from an api call made on the cloud, and should trigger a notification on one of my agents' pc (assuming running windows 10)
I'd like to do that in python as this is my knowledge
How should I structure this ?
The hardest part I can't figure out and couldn't find anything online is how to link the "local" pc to the "server"/cloud system (i'm using aws if that is useful) which would store the notification and dispatch them for each one of my agent.
My ultimate goal is to use a phone solution like aircall and to show the contact name of the caller through a notification popup in windows (aircall does offer that natively but can't access my contact datrabase so i'm trying to override the same function of displaying the caller name)
any help or suggesiton appreciated
One solution could be to build a simple ElectronJS frontend app that runs on your agents' computer AND a Python web server that listens to Aircall's Webhook events.
The web server would listen to call.ringing_on_agent Webhook events sent from Aircall and send a WebSocket push event (using Pusher for example) to your ElectronJS app.
The ElectronJS app installed by your agents would listen to WebSockets from your Python web server and would trigger a native Windows notification with the information you want (check the doc here).

Enable Google Assistant in Windows

I am trying to do some automations using Google Assistant. Is it possible to integrate the mobile google assistant app with python? For example if I say open edge in my PC in my mobile and I am able to fetch the same from a python app running on my PC, I can create custom actions based on that. Can anyone help me with how can that be possible?
At the highest level, Google Assistant is able to be programmed using "Actions on Google". Actions on Google takes your audio input and drives a service called "Dialog Flow". Dialog Flow parses your natural language looking for an "intent" (what you are asking for). When an intent is matched, a "Webhook" can be called to process the request.
If you have an application running on your Windows PC that is listening for an incoming REST request and can process the payload content, then the Webhook specified in Dialog Flow can be used to invoke your Windows application (REST app) that can perform the work.
Wiring all this up does take some skills. Some good reading to start with would be:
https://assistant.google.com/
https://www.youtube.com/channel/UC1EXoqvR9VrmWnM9S47SfVA
https://cloud.google.com/dialogflow-enterprise/docs/

How to execute actions on web without GUI

I will need to test few things from my linux server. I wonder if it is possible to manipulate some actions on web without access to browser. I have only access to linux server via command line. I know only selenium webdriver to do that actions but but for that I need browser.
What I want to do:
1) Input text to textbox on webpage using python script which is placed on linux server
2) Click button on webpage
Generally it is possible to manipulate actions on webpage from linux using python scripts?
If you input text to fom on webpage and submit the form, the browser will send POST or GET request to the server with contained information. The server then proceses (for example saves ) the information. You dont need a browser to send http request, you can send them directly from python.
AN example can be found here: How to simulate HTTP post request using Python Requests module?
If requests module isn't enough already, try using selenium with PhantomJS. PhantomJS is a headless WebKit scriptable with a JavaScript API.
PhantomJS : http://phantomjs.org
A great tutorial : https://realpython.com/headless-selenium-testing-with-python-and-phantomjs/

Categories

Resources