Facebook Event State Transfer
Sync public facebook page events to Google Calendar.
Prerequisites
Before beginning you will need to create and configure a facebook app and use it to acquire a page access token for Graph API.
You will also need to set up a Google service account to acquire a credentials file to authenticate with Google APIs.
Installation
Install fest using pip:
pip install fest
Basic Use
Use clients for facebook's Graph API and Google's Calendar API to create FacebookPage and GoogelCalendar objects, then synchronize:
import facebook
from googleapiclient import discovery
import fest
# Connect to Graph API & Calendar API
graphapi = facebook.GraphAPI('<facebook-page-token>')
calendarapi = discovery.build('calendar', 'v3', cache_discovery=False)
# Get Page/Calendar objects
page = fest.FacebookPage(graphapi, '<facebook-page-name-or-id>')
gcal = fest.GoogleCalendar(calendarapi, '<google-calendar-id>')
# Sync Calendar <= Page
req = gcal.sync(page, time_filter='upcoming')
res = req.execute()
Deployment
Several methods of deployment are provided.
AWS
A pair of terraform modules module are provided to deploy this tool as a Lambda function on AWS and invoke it on a cron using CloudWatch.
# WARNING Be extremely cautious when using secret versions in terraform
# NEVER store secrets in plaintext and encrypt your remote state
# I recommend applying the secret versions in a separate workspace with no remote backend,
# or curating them manually in the console or AWS CLI.
resource "aws_secretsmanager_secret_version" "facebook" {
secret_id = module.facebook_gcal_sync.facebook_secret.id
secret_string = "my-facebook-app-token"
}
resource "aws_secretsmanager_secret_version" "google" {
secret_id = module.facebook_gcal_sync.google_secret.id
secret_string = file("./path/to/my/svc/acct/creds.json")
}
module facebook_gcal_sync {
source = "amancevice/facebook-gcal-sync/aws"
version = "~> 1.0"
facebook_page_id = "<facebook-page-id>"
facebook_secret_name = "facebook/my-app"
google_calendar_id = "<google-calendar-id>"
google_secret_name = "google/my-svc-acct"
}
Heroku
A terraform module module is provided to deploy this tool as a Heroku application.
module facebook_gcal_sync {
source = "amancevice/facebook-gcal-sync/heroku"
app_name = "<unique-app-name>"
facebook_page_id = "<facebook-page-id>"
google_calendar_id = "<google-calendar-id>"
google_credentials_file = "<path-to-google-service-credentials>"
facebook_page_token = "<facebook-page-access-token>"
}
Alternatively, deploy with one click:
Metadata
Release files for fest 5.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fest-5.2.0.tar.gz | 13.8 kB | Without provenance | Details for fest-5.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fest-5.2.0-py3-none-any.whl | Python 3 | none | any | Details for fest-5.2.0-py3-none-any.whl |
Total release size: 22.2 kB
Release files / fest-5.2.0.tar.gz
| Download URL | fest-5.2.0.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1ff52ea5d64210fd7e385e80b7d7fc1d73de17c7f822d1d45d3d971d8c9f4054
|
|
BLAKE2b-256 checksum How to use checksums |
c48d78a2c998dbd042b53977f308bc6216aecf850cff90fb94f6e0bafe760302
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Release files / fest-5.2.0-py3-none-any.whl
| Download URL | fest-5.2.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45948b605f0fcfd894f63408d16904c48386c48ba8b60c4e920a2d0233b0dddc
|
|
BLAKE2b-256 checksum How to use checksums |
77fb4534f45ddf5fcf8217de85655d3c406712e96836214303a1d5b7ddf70d87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Security for fest 5.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.