I'm building a kivy app and almost got firebase cloud messaging working using the pyfcm
package from pypi.
What i'm stuck on is how to get the "registration token" that the firebase SDK creates on app install so that i have a registration token to send push notifications to.
There seems to be lots of info scattered around the net in regards to doing it using some other language other than "python", but python is all i know so i'm trying to work it out for that language.Any one have tips on how i go about that please ?
I can't find a python package that has the FirebaseMessaging.getToken() in it which is what the firebase documentation keeps referring to, so i'm lost and my brain is going mushy now due to researching this for hours and hours so far :)
any help appreciated
To answer my own question.
For those wondering the same question as i had. I came across this package https://github.com/Fox520/pushyy
In that package the guy has incorporated the ability to get the device token and also update the token when it changes. It takes a little manipulating to get the package to work properly with the latest gradle version but it is do able.
There doesnt seem to be a direct "python" method as such to get the token so using this package makes use of the required java and python code to achieve the task. Using this and using pyfcm from pypi to send messages, i'm now able to send firebase push notifications from my kivy app :)
Related
I would like some advice on the authorization part of a Kivy Android-focused project, with account creation and log-in functionality.
In the project I have come far enough to try to implement an account system. Though, this is where I am stuck. When going into the Firebase console, I am presented with the option to add Firebase to the Android app, but this is where the problem arises. The written-out instructions states that I need a build.gradle file among other things. Searching on Google left me with the impression that I need to use Buildozer before connecting to Firebase, is true, and is there any alternative to this? I would like to refrain from using Buildozer at this point, and still attempt to have a working Firebase system.
Watching YouTube tutorials, on how to add authentication to the Kivy project, used mainly firebase_admin or pyrebase. The pyrebase-based tutorials selected, in the console, to add Firebase to a Web-app, where they could later easily implement Firebase directly into the Kivy code without any hassle. I assume this method wouldn't work on a, to-be, Android app, or am I mistaken? I read that the firebase_admin module shouldn't be used as a main system for account creation or anything similar that is available to end-users, because of the admin-related implications of the module.
I would appreciate any help!
I'm not a newbie when it comes to python (nor a professional), but this is the first time I'm trying something like this.
I would like to upload files to OneDrive using an python script. Sounds simple right? Well apparently it's more then I can handle.
From what I've seen so far the onedrive-sdk-python I was using apparently doesn't work anymore (source: https://github.com/OneDrive/onedrive-sdk-python/issues/119) because it's being decommissioned.
The new SDK to use is the one for Microsoft Graph I guess? But the github (https://github.com/MicrosoftArchive/msgraph-sdk-python) doesn't really mention how to set up the new Oauth2 authentication, get a token and use the client in python. The links mentioned in the authentication section don't work for me, I get error messages like: "AADSTS900144: The request body must contain the following parameter: 'client_id'."
I looked on stackoverflow for similar questions but most of them are about the old onedrive-sdk and the most recent one I could find was almost 3 months old. The response there was that it was still under development.
I guess the problems I've been having are all related to the Microsoft Graph still being in development, but I was wondering if someone managed to get it to work and if they could point me in the right direction to get the authentication setup and getting me started on uploading files to OneDrive.
Some details in case it matters:
Rasbian 9 Stretch
Python 2.7.13 & Python 3.5.3 (tried both)
OneDrive business account
Many thanks to anyone who can point me in the right direction :)
I'm afraid the SDK you're using is no longer being actively maintained. From the ReadMe:
This library is no longer actively supported. To integrate Microsoft Graph into your Python solution, we recommend using REST and taking a look at our new Python samples and documentation.
To answer your question on tokens, these are not technically issued by Microsoft Graph. They're issued by Azure Active Directory (or Outlook.com for personal accounts). You obtain a token using OAuth 2.0.
You are, however, on the right track. Before you can do anything with Microsoft Graph, you're going to need to obtain an OAuth token. The good news here is there's a sample Python project that walks you through how this process works: Python authentication samples for Microsoft Graph.
After several weeks looking for some information here and google, I've decided to post it here to see if anyone with the same problem can raise me a hand.
I have a java application developed in Eclipse Ganymede using tomcat to connect with my local database. The problem is that I want to send a simple message ("Hello World") to a Kafka Topic published on a public server. I've imported the libraries and developed the Kafka function but something happens when I run in debug mode. I have no issues or visible errors when compiling, but when I run the application and push the button to raise this function it stops in KafkaProducer function because there is NoClassDefFoundError kafka.producer..... It seems like it is not finding the library properly, but I have seen that it is in the build path properly imported.
I am not sure if the problem is with Kafka and the compatibility with Eclipse or Java SDK (3.6), it could be?. Anyone knows the minimum required version of Java for Kafka?
Also, I have found that with Kafka is really used Scala but I want to know if I can use this Eclipse IDE version for not change this.
Another solution that I found is to use a Python script called from the Java application, but I have no way to call it from there since I follow several tutorials but then nothing works, but I have to continue on this because it seems an easier option. I have developed the .py script and works with the Kafka server, now I have to found the solution to exchange variables from Java and Python. If anyone knows any good tutorial for this, please, let me know.
After this resume of my days and after hitting my head with the walls, maybe someone has found this error previously and can help me to find the solution, I really appreciate it and sorry for the long history.
Please include the Kafka client library within the WAR file of the Java application which you are deploying to Tomcat
Please use org.apache.kafka.clients.producer.KafkaProducer rather than kafka.producer.Producer (which is the old client API) and make sure you have the Kafka client library on the classpath. The client library is entirely in Java. It's the old API that's written in scala, as is the server-side code. You don't need to import the server library in your code or add it to the classpath if you use the new client API.
At the end the problem was related with the library that was not well added. I had to add it in the build.xml file, importing here the library. Maybe this is useful for the people who use an old Eclipse version.
So now it finds the library but I have to update Java version, other matter. So it is solved
I am trying to build a GAE application that shell use GCM API.
(I am working with Eclipse Juno, having GWT, ADT installed).
I am using Google's python example, and I can't make it work, I'd be really grateful
if you could advise me where am I loosing my way.
First it's probably important to note that I have created a project in the Console, activated
the API, and got my project whitelisted by Google. So far so good?
I have created a python GAE project, based on Google's example in the following link -
http://developer.android.com/google/gcm/ccs.html
At this point I face the following difficulty -
client = xmpp.Client('gcm.googleapis.com', debug=['socket'])
The Client class is not recognized by the pre-interpreter. When I check in the XMPP package,
it looks though this class actually doesn't exist there... - how to handle this one?
I've tried to add the GCM APIs to the project, thinking that this might be the problem,
but the G->Add Google APIs...->Selection proposes all APIs but GCM.
My next step was to try installing google-api-python-client-gae-1.2.
I've found the following guide -
https://developers.google.com/api-client-library/python/start/get_started#simple
I've installed the lib, and then paid attention to the fact that in GAE, all source should be present in the project lib - so I have manually copied "apiclient" lib's content to my src lib.
Nevertheless, for the following line I've added from Google's example -
service = build('my_service', 'v1', developerKey=api_key)
when I run the GCC application, the following error occurs:
from apiclient.discovery import build
ImportError: No module named apiclient.discovery
I'm struggling through those issues quite a while, please help...
You're mostly headed in the wrong direction.
App Engine's XMPP API lets you send and respond to XMPP messages. See the docs:
https://developers.google.com/appengine/docs/python/xmpp/
There's no "Client" class. You have to code against the API provided by the XMPP service.
You're better off just using the HTTP connection server instead of XMPP. It's more straightfoward:
http://developer.android.com/google/gcm/http.html
http://developer.android.com/google/gcm/server.html says
Note that Google AppEngine does not support connections to CCS
I am attempting to work with Google Checkout on Google App Engine. Currently, I am writing everything in Python and have the checkout process working. I am having some difficulty getting the notifications of processed orders functioning. I've been searching for Python examples, but thus far have been unsuccessful. Programming directly off of the documentation provided by Google, I have not been able to get my notifications working either. Would anyone happen to have a framework/demo Google Checkout Notification example in Python?
The chippyshop source has a nice example of a python Google Checkout implementation that should get you moving in the right direction.
UPDATE: I actually ended up needing to do this myself so I extended the example linked above and turned it into a reusable RequestHandler for use on GAE.
You can find the source and examples on github which should serve as a good starting point for any others following this path.