Skip to main content

Lightweight OpenGraph support for writing and validating objects.

Project description

opengraph_writer

Python package

About

This library was created to both manage writing OpenGraph data, and perform lightweight verifications for offline debugging.

This library does the following:

  • CREATE an object to stash OGP data
  • VALIDATE the data, offering debug information on the object
  • RENDER the object as html, and optionally include debug data on incorrect elements

This is currently aimed at "single object page data". It is not necessarily with multi-value items yet (such as multiple profiles or tracks on a single page).

Most of the validation routines were derived from regexing the https://ogp.me site into a Python dict, and researching what they are supposed to do. The validation routes themselves are super trivial.

At the time of initially writing this library, and several checks ever since, the specification on the https://ogp.me seems out of date.

In practice, Facebook's "premier" partners seem to all be using URLs which point to certain data , however there aren't any guidelines for this within the public OGP spec.

An example would be on the Spotify integration: when looking at a SONG, the ARTIST and ALBUM refer to URLs which contain the relevant data.

Documentation

The Python file contains extensive inline documentation.

Contributions Welcome!

If anyone wants to fork and tackle the multiple value problem, please do.

Framework Support: Pyramid

This package offers an includeme for Pyramid to set up an opengraph_item as a @reify request method.

Simply update your application:

config.include("opengraph_writer.pyramid_helpers")

And your Request objects will be extended as such:

request.opengraph_item

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for opengraph-writer, version 0.3.3
Filename, size File type Python version Upload date Hashes
Filename, size opengraph_writer-0.3.3.tar.gz (11.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page