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
Release files for opengraph-writer 0.4.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 | |
|---|---|---|---|
| opengraph_writer-0.4.0.tar.gz | 13.8 kB | Details |
Release files / opengraph_writer-0.4.0.tar.gz
| Download URL | opengraph_writer-0.4.0.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a491ce7241bb35d0b66a3e0e01848255d3bd197fb1af927a14f763962014af05
|
|
BLAKE2b-256 checksum How to use checksums |
dff605e93aa9a0a3fe33c21dfcd82763c29a7968cab7204534f71c717e92ceaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|