Saravanan666/pypi-org huggingface dataset:
Package: json-relational
json_relational: Transforming Nested JSON to Relational Formatjson_relationalis a small Python package for converting complex, nested JSON data into a flat, relational format. This transformation makes it significantly easier to work with JSON data in contexts where relational databases are more suitable, such as SQL databases. The package is designed to be dynamic and flexible, accommodating various levels of nested structures and converting them into a format that can be easily mapped to SQL tables.FeaturesDynamic Nesting Handling: Effortlessly manages various levels of nested JSON data.SQL Table Ready: Transforms JSON into a format that is easily convertible to SQL tables.Customizable Depth Control: Set the maximum depth for flattening nested structures.Key Mapping Support: Allows for the remapping of keys to desired names in the output.InstallationTo installjson_relational, clone the repository from GitHub and install it using pip:gitclonehttps://github.com/gr0vity-dev/json-relational.gitcdjson_relational
pipinstall.UsageHere's a simple example to demonstrate howjson_relationalcan be used to transform nested JSON data into a relational format:fromjson_relationalimportJsonRelationalimportjson# Example JSON datajson_data={"type":"employee","id":123,"data":{"department":"sales","manager":"Bob"}}# Create an instance of JsonRelationaljr=JsonRelational()# Flatten the JSON dataflattened_data=jr.flatten_json(json_data)print(json.dumps(flattened_data,indent=4))Output:The output will be a dictionary containing flattened data, along with mappings and accumulated children, ready to be transformed into SQL tables.{"log":[{"sql_id":1,"type":"employee","id":123}],"data":[{"sql_id":1,"department":"sales","manager":"Bob"}],"mappings":[{"main_type":"log","main_sql_id":1,"link_type":"data","link_sql_id":1}]}ContributingContributions, issues, and feature requests are welcome! Feel free to checkissues page.LicenseDistributed under the MIT License. SeeLICENSEfor more information.json_relationaloffers an innovative solution for managing and transforming JSON data into a relational structure, making it an invaluable tool for database management, data analysis, and software development involving complex JSON data structures.
Package: json-repository
json_repositoryInstallhttps://pypi.org/project/json-repository/pip install json-repositoryExamplesYou can also go toteststo check a good how-to!Creating custom repositoryclassFoo(object):foo=Nonebar=Noneid=NoneclassFoobarRepository(BaseJsonRepository):def__init__(self):super(FoobarRepository,self).__init__(Foo)using created repositorywithFoobarRepository()asrepo:forentityinrepo.get_all():repo.delete(entity)repo.context.commit()
Package: json-repr
json-reprPretty print JSON like data structures with a "repr(...)" fallback, e.g. for MongoDB typesUsageimportjson_repr# JSON: Legacy Mongo Shell Formatoriginal_source="""{"_id": ObjectId("507f1f77bcf86cd799439011"),"employees": [{"firstName": "Alice","middleName": null,"id": NumberInt(1),"active": true},{"firstName": "Bob","middleName": null,"id": NumberInt(2),"active": false}]}"""document=json_repr.eval_mongo_db_json(original_source)print(document["employees"][0])dumped_source=json_repr.dumps(document)print(dumped_source)print(dumped_source==original_source)MongoDBCurrently supported (legacy) mongo shell types:ObjectIdNumberIntNumberLongNumberDecimalandnulltruefalse
Package: jsonrequest
JSONRequestLightweight wrapper for requests library that only supports Content-Type: application/json.This only supportsGET,POST,PATCH, andDELETEhttp(s) request methods.How to UseFirst, install the packagepipinstalljsonrequestThen, you can use the package.>>>fromjsonrequestimportRequestModel,make_request>>>r=make_request(RequestModel(endpoint="",method='GET',url='https://google.com'))>>>r<Response[200]>>>>Note:This data passed also only applies toapplication/jsoncontent.Across multiple times over the past many years in my python projects, I found this codeblock repeated whenever I tried to make various http(s) requests using the requests library and thought it'd be much simpler to pass the method as a parameter instead of changing the function.Here's a medium articleof how I created this package as a result. Hope this helps and Happy coding :)by Justin
Package: jsonrequester
JSONRequester is a wrapper around Httplib2 to interact with JSON APIs. It works
similarly to Httplib2 but converts request and response data to and from JSON.Installingpip install jsonrequesterCreate a new requesterfrom jsonrequester import JsonRequesterrequester = JsonRequester(’http://example.com’)Make a requestrequester.post(‘/post_handler’, {‘example’: ‘data’})MethodsMethods forGETandPOSTare provided as.getand.postmethods on the
requester. Any additional HTTP methods you need can be made using therequestmethod
on the requester.requester.request(‘PUT’, ‘/put_handler’, {‘example’: ‘data’})
Package: jsonrequest-JustinRWong
JSONRequestLightweight wrapper for requests library that only supports Content-Type: application/json.This only supportsGET,POST,PATCH, andDELETEhttp(s) request methods.How to UseFirst, install the packagepipinstalljsonrequestThen, you can use the package.>>>fromjsonrequest.jsonrequestimportRequestModel,make_request>>>r=make_request(RequestModel(endpoint="",method='GET',url='https://google.com'))>>>r<Response[200]>>>>Note:This data passed also only applies toapplication/jsoncontent.Across multiple times over the past many years in my python projects, I found this codeblock repeated whenever I tried to make various http(s) requests using the requests library and thought it'd be much simpler to pass the method as a parameter instead of changing the function. I created this package as a result. Hope this helps and Happy coding :)by Justin
Package: jsonresolver
JSON data resolver with support for plugins.This is an experimental developer preview release.Free software: BSD licenseDocumentation:https://jsonresolver.readthedocs.io/ChangesVersion 0.3.2 (released 2022-10-31)Make the module compatible with jsonref v1.0.0Version 0.3.1 (released 2020-05-06)Deprecated Python versions lower than 3.6.0. Now supporting 3.6.0 and 3.7.0.Version 0.3.0 (released 2020-03-12)Drops support for Python 2.7Updates testing methodUpdates python dependenciesVersion 0.2.1 (released 2016-04-15)Bug fixesFixes issue with exceptions raised during e.g. resolver plugin
loading being caught and not propagated.Version 0.2.0 (released 2016-04-06)Incompatible changesChanges resolving to be based on hostname without ‘http://’ prefix.Bug fixesFixes issues with the hostname not being matched resulting in the
same route on two hosts not to work.Version 0.1.1 (released 2015-12-11)Improved featuresDelays the url_map building until first resolve request.Version 0.1.0 (released 2015-11-18)Initial public release.
Package: json-rm
json-rmThis tool parses a JSON Schema into "Entities" and "Attributes", which correspond to tables and columns in a relational database. It can be used to output different representations of the data model described by the input schema.Installationpip install json-rmCommand line usagejst <command> <schema_path>ExamplesUse the 'simple' formatter on a schema:$ jst simple resources/schemas/1.2.246.537.6.1506.7000.2022.1.10.jsonUse the 'postgres' formatter on a schema:$ jst postgres resources/schemas/1.2.246.537.6.1506.7000.2022.1.10.jsonUse the 'spark' formatter on a schema:$ jst spark resources/schemas/1.2.246.537.6.1506.7000.2022.1.10.jsonUsing from your Python codeimport json_rm
from json_rm.formatters import SimpleFormatter

schema = json_rm.JSONSchema.from_file("schema.json")
formatter = SimpleFormatter()

print(schema.render(formatter))Parsing optionsnormalizationDenormalized (default) mode results in a flat structure with less tables.Normalized mode results in a deep structure with more tables.Whennormalizationis set toFalse(default), the parser operates in "denormalized" mode, creating a newEntityonly for the root object and repeating (array) objects. In the "normalized mode, a separateEntityis created for each nested structure (JSON objects and arrays).
Package: jsonrpc2-objects
JSON-RPC 2.0 ObjectsA collection of objects for use in JSON-RPC 2.0 implementations.Installationpoetryaddjsonrpc2-objectspipinstalljsonrpc2-objectsObjectsAvailable inobjectsare the following:ObjectDescriptionParamsRequestRequest with paramsRequestRequest without paramsParamsNotificationNotification with paramsNotificationNotification without paramsErrorResponseResponse with resultResultResponseResponse with errorErrorsPython exceptions are available for each JSON-RPC 2.0 error. Each error
extendsJSONRPCError.JSONRPCErrorInternalErrorInvalidParamsInvalidRequestMethodNotFoundParseErrorServerError
Package: jsonrpc2-pyclient
JSON RPC PyClientA library for creating JSON RPC 2.0 clients in Python with async supportInstallpoetryaddjsonrpc2-pyclientpipinstalljsonrpc2-pyclientExampleExample of the client decorator implementing rpc methods from reading
method signatures.importasynciofrompydanticimportBaseModelfromjsonrpc2pyclient.decoratorimportrpc_clientfromjsonrpc2pyclient.httpclientimportAsyncRPCHTTPClienttransport=AsyncRPCHTTPClient("http://127.0.0.1:8000/api/v1")classVector3(BaseModel):x:float=1.0y:float=1.0z:float=1.0@rpc_client(transport=transport)classTestClient:asyncdefadd(self,a:int,b:int)->int:...asyncdefget_distance(self,a:Vector3,b:Vector3)->Vector3:...asyncdefmain()->None:client=TestClient()assertawaitclient.add(3,4)==7assertawaitclient.get_distance(Vector3(),Vector3())==Vector3(x=0,y=0,z=0)if__name__=="__main__":asyncio.run(main())RPCClient Abstract ClassJSON-RPC 2.0 is transport agnostic. This library provides an abstract
class that can be extended to create clients for different transports.TransportsTo make client for a transport, extend theRPCClientclass and
implement the_send_and_get_jsonwhich takes a request as a str and is
expected to return a JSON-RPC 2.0 response as a str or byte string.RPCClienthas acallmethod that uses this internally.A default HTTP and Websocket implementation is provided.UsageTheRPCClientwill handle forming requests and parsing responses.
To call a JSON-RPC 2.0 method with an implementation ofRPCClient,
call thecallmethod, passing it the name of the method to call and
the params.If the response is JSON-RPC 2.0 result object, only the result will be
returned, none of the wrapper.If the response is JSON-RPC 2.0 error response, and exception will be
thrown for the error.fromjsonrpc2pyclient.httpclientimportRPCHTTPClientfromjsonrpcobjects.errorsimportJSONRPCErrorclient=RPCHTTPClient("http://localhost:5000/api/v1/")try:res=client.call("divide",[0,0])print(f"JSON-RPC Result:{res}")exceptJSONRPCErrorase:print(f"JSON-RPC Error:{e}")Client DecoratorTherpc_clientdecorator can be used to quickly put together a client
with typed methods. When a class is decorated, each method defined in
that class will make RPC requests using the provided transport and parse
the result. The name of the method will be used in the RPC request.The method body must end with...for the decorator to implement it.transport=RPCHTTPClient("http://127.0.0.1:8000/api/v1")@rpc_client(transport=transport)classTestClient:defadd(self,a:int,b:int)->int:...client=TestClient()assertclient.add(3,4)==7
Package: jsonrpc2-zeromq
Written byDan Brown. See the the LICENSE file for licensing information.This is a library in Python enablingJSON-RPC 2.0overZeroMQ. It includes support for both clients and servers.This is packaged as a standard Python project, so just install usingpython setup.py install, or withpip.Supports Python 2.7 and 3.3+.Serversfrom jsonrpc2_zeromq import RPCServer

class EchoServer(RPCServer):

    def handle_echo_method(self, msg):
        return msg

s = EchoServer("tcp://127.0.0.1:57570")
s.run()This creates a server listening on a ZeroMQ REP socket – so only methods are allowed, not notifications. See theRPCNotificationServeras well, which will listen on a ROUTER socket and allow notifications.Each server is a PythonThread, so the call torun()can be replaced bystart()to have it running in a background thread.Clientsfrom jsonrpc2_zeromq import RPCClient

c = RPCClient("tcp://127.0.0.1:57570")
print c.echo("Echo?")

# Assuming the above compliant server, should print "Echo?"There are various classes, assuming different JSON-RPC 2.0 and ZeroMQ characteristics. The above, for example, will connect a REQ socket to the given endpoint.NotificationsGiven a server that accepts notifications:from jsonrpc2_zeromq import RPCNotificationServer

class EventReceiver(RPCNotificationServer):

    def handle_event_method(self, event_type, event_data):
        print "Got event!\nType: {0}\nData: {1}\n".format(event_type, event_data)

s = EventReceiver("tcp://127.0.0.1:60666")
s.run()You can then send notifications thus:from jsonrpc2_zeromq import RPCNotifierClient

c = RPCNotifierClient("tcp://127.0.0.1:60666")
c.notify.event('birthday!', 'yours!')Also included areNotificationOnlyPullServerandNotifierOnlyPushClientwhich are designed for sending only notifications one-way over PUSH and PULL sockets.There is also a client,NotificationReceiverClient, that is able to handle notifications returned back to it from a server. This is useful for situations where you “subscribe”, via a standard RPC call, to events from the server, and they are returned back to the client as notifications when they occur. There is not currently a corresponding server class for this pattern. Here is a (one-sided) example:from jsonrpc2_zeromq import NotificationReceiverClient

class EventSubscriber(NotificationReceiverClient):

    def handle_event_notification(self, event_type, event_data):
        print "Got event!\nType: {0}\nData: {1}\n".format(event_type, event_data)

c = EventSubscriber("tcp://127.0.0.1:60666")
c.subscribe()
c.wait_for_notifications()LoggingThestandard Python logging moduleis used for logging. It doesn’t output anything by default. Either retrieve the built-in library logger withlogging.getLogger('jsonrpc2_zeromq')or pass your ownLoggerinstance into a client or server’s__init__with theloggerkeyword argument.Currently there are some helpful messages outputted at theDEBUGlevel, server exceptions onERROR, and a server start message onINFO.TestingTests are included. Runpython setup.py testin the project root.History2.0Python 3.3+ support1.1.2Allow newer (v14) pyzmq.Don’t raise EINTR in server recv loop.
Package: json-rpc-3
Pure Python 3JSON-RPC 2.0transport specification implementation. Supports python3.2+.
Fork ofjson-rpc.Documentation:http://json-rpc-3.readthedocs.orgThis implementation does not have any transport functionality realization, only protocol.
Any client or server realization is easy based on current code, but requires transport libraries.Installpipinstalljson-rpc-3TestsnosetestsQuickstartSeeexamples.
Package: jsonrpc-async
This is a compact and simple JSON-RPC client implementation for asyncio python code. This code is forked fromhttps://github.com/gciotta/jsonrpc-requestsMain FeaturesSupports nested namespaces (eg.app.users.getUsers())100% test coverageUsageIt is recommended to manage the aiohttp ClientSession object externally and pass it to the Server constructor.(See the aiohttp documentation.)If not passed to Server, a ClientSession object will be created automatically.Execute remote JSON-RPC functionsimportasynciofromjsonrpc_asyncimportServerasyncdefroutine():asyncwithServer('http://localhost:8080')asserver:awaitserver.foo(1,2)awaitserver.foo(bar=1,baz=2)awaitserver.foo({'foo':'bar'})awaitserver.foo.bar(baz=1,qux=2)asyncio.get_event_loop().run_until_complete(routine())A notificationimportasynciofromjsonrpc_asyncimportServerasyncdefroutine():asyncwithServer('http://localhost:8080')asserver:awaitserver.foo(bar=1,_notification=True)asyncio.get_event_loop().run_until_complete(routine())Pass through arguments to aiohttp (see alsoaiohttp  documentation)importasyncioimportaiohttpfromjsonrpc_asyncimportServerasyncdefroutine():asyncwithServer('http://localhost:8080',auth=aiohttp.BasicAuth('user','pass'),headers={'x-test2':'true'})asserver:awaitserver.foo()asyncio.get_event_loop().run_until_complete(routine())Pass through aiohttp exceptionsimportasyncioimportaiohttpfromjsonrpc_asyncimportServerasyncdefroutine():asyncwithServer('http://unknown-host')asserver:try:awaitserver.foo()exceptTransportErrorastransport_error:print(transport_error.args[1])# this will hold a aiohttp exception instanceasyncio.get_event_loop().run_until_complete(routine())TestsInstall the Python tox package and runtox, it’ll test this package with various versions of Python.Changelog2.1.2 (2023-07-10)Add support forasync with(#10)@lieryan2.1.1 (2022-05-03)Unpin test dependencies2.1.0 (2021-05-03)Bumped jsonrpc-base to version 2.1.02.0.0 (2021-03-16)Bumped jsonrpc-base to version 2.0.0BREAKING CHANGE:Allow single mapping as a positional parameter.Previously, when calling with a single dict as a parameter (example:server.foo({'bar':0})), the mapping was used as the JSON-RPC keyword parameters. This made it impossible to send a mapping as the first and only positional parameter. If you depended on the old behavior, you can recreate it by spreading the mapping as your method’s kwargs. (example:server.foo(**{'bar':0}))1.1.1 (2019-11-12)Bumped jsonrpc-base to version 1.0.31.1.0 (2018-09-04)Added support for using a custom json.loads method(#1)@tdivis1.0.1 (2018-08-23)Bumped jsonrpc-base to version 1.0.21.0.0 (2018-07-06)Bumped minimum aiohttp version to 3.0.0Bumped jsonrpc-base to version 1.0.1Credits@gciottafor creating the base projectjsonrpc-requests.@mbroadstfor providing full support for nested method calls, JSON-RPC RFC
compliance and other improvements.@vaabfor providing api and tests improvements, better RFC compliance.
Package: jsonrpc-base
This is a compact and simple JSON-RPC client implementation interface python code. This code is forked fromhttps://github.com/gciotta/jsonrpc-requestsMain FeaturesPython 3.6, 3.7, 3.8 & 3.9 compatibleSupports nested namespaces (eg.app.users.getUsers())100% test coverageUsageSeejsonrpc-asyncandjsonrpc-websocketfor example implementations.TestsInstall the Python tox package and runtox, it’ll test this package with various versions of Python.Changelog2.2.0 (2023-12-11)Omit params attribute when empty(#9)@Makman22.1.1 (2022-05-03)Unpin test dependencies2.1.0 (2021-05-03)Use uuid4 for request IDs2.0.0 (2021-03-16)BREAKING CHANGE:Allow single mapping as a positional parameter.Previously, when calling with a single dict as a parameter (example:server.foo({'bar':0})), the mapping was used as the JSON-RPC keyword parameters. This made it impossible to send a mapping as the first and only positional parameter. If you depended on the old behavior, you can recreate it by spreading the mapping as your method’s kwargs. (example:server.foo(**{'bar':0}))1.1.0 (2020-08-24)Support for async server request handlers1.0.3 (2019-11-12)Forwards compatibility for Python 3.9.(#4)@a1fred1.0.2 (2018-08-23)Improved support for JSON-RPC v1 servers.(#2)@tdivis1.0.1 (2018-07-06)Falsey values are no longer treated as None for message IDs, or request parameters.Credits@gciottafor creating the base projectjsonrpc-requests.@mbroadstfor providing full support for nested method calls, JSON-RPC RFC
compliance and other improvements.@vaabfor providing api and tests improvements, better RFC compliance.
Package: jsonrpcclient
Generate JSON-RPC requests and parse responses in Python.pipinstalljsonrpcclientGenerate a request:fromjsonrpcclientimportrequest,parsereq=request("ping")# => {'jsonrpc': '2.0', 'method': 'ping', 'id': 1}Parse a response:parsed=parse({"jsonrpc":"2.0","result":"pong","id":1})# => Ok(result='pong', id=1)For strings, userequest_jsonandparse_json.Watch a video on how to use itFull documentation is atjsonrpcclient.com.See also:jsonrpcserver
Package: jsonrpcdb
JSON-RPC DB===========|Build Status| |Codacy Badge| |Codacy Badge|Primary goal------------This library realize Python Database API Specification v2.0 `PEP249 <https://www.python.org/dev/peps/pep-0249/>`__ for`JSON-RPC <http://www.jsonrpc.org/specification>`__. Standart pythondatabase api, but under the hood you make remote procedure call.Install-------.. code:: bashpip install jsonrpcdbUsage-----.. code:: pythonimport jsonrpcdb# without authenticationconn_params = {'host': 'ip/hostname',  # default localhost'port': 4000,  # default 4000'database': 'uri path', # default empty value'schema': 'http/https', # default http}# with token authenticationconn_params = {'host': 'ip/hostname','port': 4000,'database': 'uri path','schema': 'http/https','user': 'username','password': 'password','auth_type': 'token'}conn = jsonrpcdb.connect(**conn_params)cur = conn.cursor()data = {'params': {} # remote procedure parameters}cur.execute('some_method', data)results = cur.fetchall().. |Build Status| image:: https://travis-ci.org/LiveStalker/json-rpc-db.svg?branch=master:target: https://travis-ci.org/LiveStalker/json-rpc-db.. |Codacy Badge| image:: https://api.codacy.com/project/badge/Coverage/52f1f4086b654639b78ffc0b28bb9b00:target: https://www.codacy.com/app/LiveStalker/json-rpc-db?utm_source=github.com&utm_medium=referral&utm_content=LiveStalker/json-rpc-db&utm_campaign=Badge_Coverage.. |Codacy Badge| image:: https://api.codacy.com/project/badge/Grade/52f1f4086b654639b78ffc0b28bb9b00:target: https://www.codacy.com/app/LiveStalker/json-rpc-db?utm_source=github.com&utm_medium=referral&utm_content=LiveStalker/json-rpc-db&utm_campaign=Badge_Grade
Package: jsonrpcparts
JSON-RPC Parts is a library of composable components one would need to assemble a JSON-RPC server or client.The parts provided are JSON-RPC message parser and serializer, a generic request handler collection, a WSGI-specific request handler and bits and pieces.This JSON-RPC Parts collection supports both, JSON-RPC v.1.0 and v.2.0 including “batch” mode for v.2.0.The parts are split into separate modules that can be used separately from this collection.Since this collection is MIT-licensed, you are free grab a part of this code and use it in alsmost any.
Package: jsonrpc-py
JSON-RPC PythonJSON-RPC Pythonis a lightweight ASGI micro framework for building web applications.FeaturesPure zero-dependency JSON-RPC 2.0 implementation.Simple and user-friendly API interface.100% type annotated codebase.100% test coverage, so it's production-ready.RequirementsPython 3.11 and above.Installation$pipinstalljsonrpc-pyDistributionThis project is licensed under the terms of theBSD 3-Clause License.LinksDocumentation:https://docs.jsonrpc.ruPyPI Releases:https://pypi.org/project/jsonrpc-pySource Code:https://gitlab.com/jsonrpc/jsonrpc-py
Package: jsonrpc-pyclient
jsonrpc_pyclient is a transport-agnostic json-rpc 2.0 and 1.0 client library primarily intended for use withlibjson-rpc-cppbut can be used with other json-rpc server implementations.This library is intended to be used with libjson-rpc-cpp’s stubgenerator,
which takes a json-formatted specification file, and can then return server
and client stubs in various languages; the python client stub generator was
created to use this library. For more information on using the stubgenerator,
refer to libjson-rpc-cpp’s documentation.Currently Supported Transportshttptcp socketsBasic Usage>>>fromjsonrpc_pyclient.connectorsimportsocketclient>>>importClientStub#client stub created by libjson-rpc-cpp stubgenerator>>>connector=socketclient.TcpSocketClient("127.0.0.1",8032)>>>client=ClientStub(connector)>>>result=client.addNumbers(4,5)>>>print(result)Installation$pipinstalljsonrpc_pyclient