Lightweight OpenGraph support for writing and validating objects.
Project description
opengraph_writer
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file opengraph_writer-0.4.0.tar.gz
.
File metadata
- Download URL: opengraph_writer-0.4.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/5.0.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a491ce7241bb35d0b66a3e0e01848255d3bd197fb1af927a14f763962014af05 |
|
MD5 | 15c41b16bc1e6c99d1b89348fb35c906 |
|
BLAKE2b-256 | dff605e93aa9a0a3fe33c21dfcd82763c29a7968cab7204534f71c717e92ceaa |