semvec/pypi-packages huggingface dataset:
Configurable-JSON 1.1.0
Easily Extend the JSON Encoder with Custom Rules
Requires Python: >=3.10

# Configurable JSON Encoder

By default, the json.Encoder class' logic can only be customized to a certain extent:

- a 'default' method can be overwritten to encode objects that JSON can't serialize by default;
- an 'encode' method can be overwritten to fully rewrite the encoding logic, which is powerful but can be hard to change
  if you need to change the specific behavior for a type in a nested structure;
- an 'iterencode' method can be overwritten to handle the recursive behavior of the JSON encoder, but this method uses
  functions under the hood that are not defined as class methods but rather as functions in the encoder
  module (`c_make_encoder` and `_make_iterencode`), which thus can not be overwritten by class inheritance.

This module aims to help make adding custom rules to the JSON encoder easier, by injecting a middle
layer `ConfigurableJsonEncoder` which essentially uses a copied and slightly modified version of `_make_iterencode` from
the original module.

Some examples of things you can do with this module (see examples.py for the actual rules)

```python
from examples import *

data = {
    'original': ['behavior'],
    'set': {1, 2, 3},
    'namedtuple': Letters('a', 'b', 'c'),
    "class": MyClass()
}
try:
    print(json.dumps(data))
except TypeError:
    ...  # Object of type set is not JSON serializable

# default behavior without type error:
print(json.dumps(data, default=str))
# {"original": ["behavior"], "set": "{1, 2, 3}", "namedtuple": ["a", "b", "c"], "class": "<__main__.MyClass object at 0x...>"}

# the same behavior as above
print(json.dumps(data, cls=DummyEncoder))
# {"original": ["behavior"], "set": "{1, 2, 3}", "namedtuple": ["a", "b", "c"], "class": "<__main__.MyClass object at 0x...>"}

# encodes set into a list:
print(json.dumps(data, cls=SetEncoder))
# {"original": ["behavior"], "set": [1, 2, 3], "namedtuple": ["a", "b", "c"], "class": "<__main__.MyClass object at 0x...>"}

# calls .tojson() which uses transform to output a string
print(json.dumps(data, cls=ToJSONEncoder))
# {"original": ["behavior"], "set": "{1, 2, 3}", "namedtuple": ["a", "b", "c"], "class": ["my", "data", "as", "json"]}

# converts namedtuple to a dictionary instead of a list (the default behavior)
print(json.dumps(data, cls=MyEncoder))
# {"original": ["behavior"], "set": [1, 2, 3], "namedtuple": {"a": "a", "b": "b", "c": "c"}, "class": {"my data": ["as", "a", "dict"]}}

```

## Usage:

Simply extend `ConfigurableJsonEncoder` with a `rules` method that returns a `JSONRule` or `None` based on the
input `o` (which is one unit in the nested data tree). Again, see `examples.py` for inspiration.
PySocketLib 0.3.2
Library to simplify working with socket
Requires Python: >=3.7

# PySocketLib

PySocketLib is a free and open-source cross-platform library to simplify working with sockets. Windows, MacOS and Linux are supported. Installation:

```bash
pip install PySocketLib
```

## Features

- TCP, UDP
- IPv4 and IPv6 support

## Resources

Github of the project - [https://github.com/Minuta18/PySocketLib](https://github.com/Minuta18/PySocketLib)
Please, write your feedback, ideas or issues [there](https://github.com/Minuta18/PySocketLib/issues) ("Issues" tab in github)
Documentation is available at [https://github.com/Minuta18/PySocketLib/wiki](https://github.com/Minuta18/PySocketLib/wiki)
bb-connector 0.0.4
This project is a flask-service for calculating Bloomberg query's as a REST service.
Requires Python: >=3.11

# bb-connector

## About this Project

This Project represents a flask service, which connects to bloomberg to get data from the API.

The service has the following REST-endpoints:

### /primary_exchange_securities:
- this endpoint is used if you want to get all securities on the primary exchange


### /fundamental_tickers:
- this endpoint is used if you want to get all securities for a primary exchange on the remote market

### /members:
- this endpoint is used if you want ETF/Index constituents

### /field:
- this endpoint is used if you want a BDP request for a special security
zoho-client-django 1.2.2
Django app which is a client for the Zoho CRM API

# zoho-client-django

A modest Zoho CRM API client which will do the oAuth2 for you.

## Usage

```python
 from zoho_client.zoho import ZohoClient
 client = ZohoClient()
 # GET all Sales_Orders
 res = client.make_request(api_endpoint="Sales_Orders")
 # res is an instance of requests.Response
 for sales_order in res.json()['data']:
    print(f"sales order #{sales_order['id']}")

 # find the first record
 sales_order_id = res.json()['data'][0]['id']

 # update the sales order's subject
 payload = {'data': [ {'Subject': 'CHANGED'}]}
 # the make_request accpet any kwargs which the requests.request() method accpets
 res = client.make_request(method='PUT', api_endpoint=f"Sales_Orders/{sales_order_id}", json=payload)
 print(res.json()['data'][0]['status'])
 # => success

 # search for a record. the params are automatically encoded
 res = client.make_request("GET", "Accounts/search", params= {"criteria": "(Account_Name:equals:Guy Moller)"})
 print(f"found {resp.json()['info']['count']} records")

 # create a record
 account_data={'Account_Name': 'John Doe', 'Email': 'joe@example.com'}
 res = client.make_request(method='POST', api_endpoint='Accounts',json={'data':[account_data]})
 print(res.json()['data'][0]['details']['id'])
 # => 5599334000006242002
```

# Setup

## ENV

the package expects to have it's configuration in the settings.py:

```python
# read it from .env
ZOHO_CLIENT_ID = env("ZOHO_CLIENT_ID")
ZOHO_CLIENT_SECRET = env("ZOHO_CLIENT_SECRET")
ZOHO_API_VERSION = "v2.1"
# sandbox
ZOHO_BASE_URL = "https://crmsandbox.zoho.com"
# production
# ZOHO_BASE_URL = "https://zohoapis.com"
```

and naturally, don't forget to include the app in your INSALLED_APS:

```python
INSTALLED_APPS = [
    ...
    "zoho_client",
]

```

## Initilization of the client (one off)

goto https://api-console.zoho.com/ :

copy the client id and secret and save them in your django settings. the recommended way would be to save them as ENV variables.

![step 1](images/01_zoho.png)

generate an authorization code

scope:
ZohoCRM.modules.ALL,ZohoCRM.settings.ALL,ZohoCRM.users.ALL,ZohoCRM.bulk.ALL,ZohoCRM.notifications.ALL

![step 2](images/02_zoho.png)

choose either production or sandbox

![step 3](images/03_zoho.png)

press generate and copy the code and run this from the django console:
![step 4](images/04_zoho.png)

go to django admin to zoho_client/zoho_token and press the regenerate zoho oauth tokens

![step 5](images/06_django_admin.png)

paste the authorization code you have copied before

![step 6](images/05_django_admin.png)

you are good to go!

### Programmatically:

```python
from zoho_client.zoho import ZohoClient
# the code you have just copied
code = "1000.12c557408797e20c8432216dca0bbb5f.f1896d4f9e2329136806637798859a99"
ZohoClient().fetch_tokens(code)
# -> '1000.03b32b6490d8573e242664710bbc4f2c.e009198b6ab4b89013485657409e4913'
```
jref 0.4.1
JSON Reference and JSON Pointer implementations
Requires Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*

# python-jref

This python package implements the JSON Reference and JSON Pointer
specifications in the context of processing JSON and YAML content, such as
Swagger and OpenAPI specifications.

## JSON Reference

JSON Reference defines a mechanism to reference and include content from the
same or separate documents. This helps with maintenance of structured data and
documents by reducing repetition, and allowing for the organization of larger
documents across multiple files.

## JSON Pointer

JSON Pointer defines a syntax for identifying specific portions of a JSON
value.

In a document, a JSON Reference takes the form of an object, mapping '$ref' to a
reference; other keys in the object are ignored. The reference itself takes the
form of a URI. As an example:

    { "$ref": "http://example.com/example.json#/foo/bar" }

In this implementation, the URI may reference a JSON or YAML file available in
the local filesystem, or served from the network over HTTP/HTTPS. The fragment
portion of the URI is interpreted as a JSON Pointer.

## Usage example

Find the example below also as [`usage-example.py`](usage-example.py) in the
source repository.

```python
import os
import textwrap

import jref.context
import jref.pointer

# All references are evaluated in a context, so start with one
ctx = jref.context.RemoteContext()

# Reference a remote document
spec = ctx.parse_reference('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml')

# Reference portions of that document
spec_title = spec.context.parse_reference('#/info/title')
spec_version = spec.context.parse_reference('#/info/version')

# Print out the references, not the content (which hasn't been loaded)
print(textwrap.dedent('''
    * JSON References
    Spec:    {}
    Title:   {}
    Version: {}
    ''')
    .lstrip()
    .format(spec, spec_title, spec_version))

# Expand references, triggering loading of content
print(textwrap.dedent('''
    * Evaluated references
    Title:   {}
    Version: {}
    ''')
    .lstrip()
    .format(spec_title.expand(), spec_version.expand()))
```

Expected output:

```
* JSON References
Spec:    https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml
Title:   https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml#/info/title
Version: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml#/info/version

* Evaluated references
Title:   Swagger Petstore
Version: 1.0.0

```

## References

* JSON Reference, Internet Draft,
  https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03
* JSON Pointer, RFC 6901, https://tools.ietf.org/html/rfc6901