I've recently started using Google App Engine with Python, to act as an FCM app server. Before, in tests of FCM, I used PyFCM to handle the messaging, and I've been trying to get it to work with GAE. I followed the instructions here for using third-party Python libraries by vendoring, but it doesn't seem to be working, as I'm getting an ImportError. This is my appengine_config.py
:
from google.appengine.ext import vendor
vendor.add('lib')
And this is my code:
from pyfcm import FCMNotification
import time
push_service = FCMNotification(api_key="<my key>")
message = "Hello world! " + str(time.time())
topic = "news"
result = push_service.notify_topic_subscribers(topic_name=topic, message_body=message)
The one thing I can think of that might be the issue is that I had to use sudo to install PyFCM, since I didn't have permission otherwise, and the lib folder which was created by the installation, as well as the PyFCM files, all have a lock icon on them, which I think indicates limited permissions. Is this the problem, or is there something else I need to do?
Edit: All my code is located at the root of my project directory (/home/me/appengine/fcmtest/
), and PyFCM is installed in a folder called lib (/home/me/appengine/fcmtest/lib/
), also at the root level. This is the traceback of the error:
ERROR 2016-08-02 23:04:32,441 cgi.py:122] Traceback (most recent call last):
File "/home/me/appengine/fcmtest/job.py", line 1, in <module>
from pyfcm import FCMNotification
ImportError: No module named pyfcm