Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Utilities for working with JSON:API in Python

Project description

bikeshed

https://img.shields.io/pypi/v/bikeshed.svg https://img.shields.io/travis/wamuir/bikeshed.svg Documentation Status

Utilities for working with JSON:API in Python

Features

For now, can populate a neo4j graphdb from one or more arbitrary JSON:API documents. As an example, the following results from loading the example compound JSON:API document given at jsonapi.org:

https://raw.github.com/wamuir/bikeshed/master/docs/graph.svg?sanitize=true

Here’s the JSON:API document:

{
  "links": {
    "self": "http://example.com/articles",
    "next": "http://example.com/articles?page[offset]=2",
    "last": "http://example.com/articles?page[offset]=10"
  },
  "data": [{
    "type": "articles",
    "id": "1",
    "attributes": {
      "title": "JSON:API paints my bikeshed!"
    },
    "relationships": {
      "author": {
        "links": {
          "self": "http://example.com/articles/1/relationships/author",
          "related": "http://example.com/articles/1/author"
        },
        "data": { "type": "people", "id": "9" }
      },
      "comments": {
        "links": {
          "self": "http://example.com/articles/1/relationships/comments",
          "related": "http://example.com/articles/1/comments"
        },
        "data": [
          { "type": "comments", "id": "5" },
          { "type": "comments", "id": "12" }
        ]
      }
    },
    "links": {
      "self": "http://example.com/articles/1"
    }
  }],
  "included": [{
    "type": "people",
    "id": "9",
    "attributes": {
      "firstName": "Dan",
      "lastName": "Gebhardt",
      "twitter": "dgeb"
    },
    "links": {
      "self": "http://example.com/people/9"
    }
  }, {
    "type": "comments",
    "id": "5",
    "attributes": {
      "body": "First!"
    },
    "relationships": {
      "author": {
        "data": { "type": "people", "id": "2" }
      }
    },
    "links": {
      "self": "http://example.com/comments/5"
    }
  }, {
    "type": "comments",
    "id": "12",
    "attributes": {
      "body": "I like XML better"
    },
    "relationships": {
      "author": {
        "data": { "type": "people", "id": "9" }
      }
    },
    "links": {
      "self": "http://example.com/comments/12"
    }
  }]
}

Which can be imported into neo4j as:

import bikeshed.neo4j

bikeshed.neo4j.load_json_document(connection, document)

History

0.1.0 (2019-08-18)

  • First release on PyPI.

0.1.1 (2019-08-18)

  • Edits to setup.py

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 bikeshed, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size bikeshed-0.1.1.tar.gz (11.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page