semvec/pypi-packages huggingface dataset:
javascript-object-notation 0.1.1
Javascript Object Notation (JON) to access JSON and YAML data.
License: MIT

# Javascript Object Notation
Allows Access to JSON/YAML data using Javascript Object Notation.

Note: This code can be applied to any Python dictionary, not only JSON or YAML.

## Installation
```
pip install javascript-object-notation
```

## Access to JSON values

Lets image we have following JSON object.
```
{  
    "employee": {  
        "name":       "Mario",   
        "salary":      1000000
    }  
}  
```

The python way to access data inside JSON is using brackets and quotes like a normal dictionary.
```
import json
json_obj1 = json.loads(json_txt)
assert json_obj1['employee']['name'] == 'Mario'
assert json_obj1['employee']['salary'] == 1_000_000
```

Using the JSON wrapper you can access data like a normal object.
```
from jon.jon_wrapper import JONFactory
...
json_obj2 = JONFactory.wrap(json_obj1)
assert json_obj2.employee.name == 'Mario'
assert json_obj2.employee.salary == 1_000_000
```

## Changing values

Is also possible modify values and get json updated.
```
json_obj2.employee.name = 'Cesar'
json_obj2.employee.salary = 500_000

expected = '{"employee": {"name": "Cesar", "salary": 500000, "married": true, "occupation": "writer"}}'
 assert f'{json_obj2}' == expected
```

## Special symbols

Some JSON properties have special characters like '$', those are not accepted as property names.
This library remove automatically those from the names and put it back when you serialize to JSON.

For instance for the below example.
```
    {  
        "type": "array",
        "$id": "https://spec.openapis.org/oas/3.1/schema/2022-10-07",
        "then": {
          "$ref": "#/$defs/reference"
        }
    }  
```

You will be able to access like this:
```
json_obj1 = json.loads(json_txt)
json_obj2 = JONFactory.wrap(json_obj1)

assert json_obj2.type == 'array'
assert json_obj2.id == 'https://spec.openapis.org/oas/3.1/schema/2022-10-07'
assert json_obj2.then.ref == '#/$defs/reference'

expected = '{"type": "array", "$id": "https://spec.openapis.org/oas/3.1/schema/2022-10-07", "then": {"$ref": "#/$defs/reference"}}'
assert f'{json_obj2}' == expected
```


## Access to YAML values

Lets image we have following YAML object.
```
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: consumer
    version: v1
  name: consumer
spec:
...
  template:
    ...
    spec:
      containers:
        - image: emmerson/cdi-rabbit-consumer:1.1.0
          imagePullPolicy: IfNotPresent
          name: cdi-rabbit-consumer
...
```

Using the JSON wrapper you can access data like a normal object.
```
d = yaml.safe_load(file)
json_obj2 = JONFactory.wrap(d)

assert json_obj2.kind == 'Deployment'
assert json_obj2.metadata.labels.app == 'consumer'
assert json_obj2.spec.template.spec.containers[0].image == 'emmerson/cdi-rabbit-consumer:1.1.0'
```

If yaml file contains multiple manifests, you can iterate them and wrap.
```
docs = yaml.safe_load_all(stream)
all = [JONFactory.wrap(doc) for doc in docs]
assert len(all) == 10
```

# Serialization
By default this library serialize its content as JSON string.
batch-mailchimp 1.2.2
A python client for MailChimp Marketing API, with batch support
License: MIT
Keywords: mailchimp marketing api client wrapper

Python BatchMailchimp
=====================

.. image:: https://img.shields.io/pypi/v/batch-mailchimp.svg
    :alt: PyPI Package latest release
    :target: https://pypi.org/project/batch-mailchimp/

.. image:: https://img.shields.io/pypi/l/batch-mailchimp.svg
    :alt: License
    :target: https://pypi.org/project/batch-mailchimp/

A light wrapper around `mailchimp-marketing <https://pypi.org/project/mailchimp-marketing/>`__ that makes it easier to use batch operations.

Getting Started
---------------

Installation
~~~~~~~~~~~~

::

   pip install batch-mailchimp

Usage
~~~~~

This can be used as a drop-in replacement for mailchimp-marketing –
just change the import at the top, and everything should work the same:

.. code:: python

   import batch_mailchimp as MailchimpMarketing

   client = MailchimpMarketing.Client({
       "api_key": "YOUR_API_KEY",
   })

The additional functionality comes when we initialise the client with ``batch=True``:

.. code:: python

   import batch_mailchimp as MailchimpMarketing

   client = MailchimpMarketing.Client({
       "api_key": "YOUR_API_KEY",
       "batch": True,
   })

If we do this, operations are stored up in the client, to be run later. For example:

.. code:: python

   # Fetch all MailChimp lists
   client.lists.get_all_lists()

All new operations will be added to the batch. When we’re ready, we can run all the operations in the batch:

.. code:: python

   batch = batch_client.batches.run()

We can check the batch’s status using:

.. code:: python

   batch.status(refresh=True)

Once it has finished, we can get the response with:

.. code:: python

   response = batch.response()
   response.body

API Structure and Endpoints
---------------------------

The API structure and endpoints match that of `mailchimp-marketing <https://mailchimp.com/developer/marketing/api/>`__. You should refer to their documentation for usage.

Support
-------

If you are having issues, please `create an issue <https://github.com/FullFact/python-batchmailchimp/issues>`__.

License
-------

The project is licensed under the MIT License.