django模块,它为netbox提供一个graphql api(用于django 1.11)

django-netbox-graphql的Python项目详细描述


===
django netbox graphql
==


netbox graphql是一个简单的django应用程序,它为netbox提供一个graphql api。
此模块已对接,**其开发仍在进行中**。包括Netbox的电路模块及其所有型号。
对于这部分应用程序,您可以执行CRUD操作。


CRUD的可用型号
----
*电路
*提供程序
*电路
*电路类型
*电路终端
*DCIM
*REGion
*站点
*租户
*租户组
*租户
*IPAM
*角色
*VLAN组
*VLAN
*VRF
*RIR
*聚合
*前缀
*虚拟化
*群集类型
*群集组
*群集
*虚拟化machine



生成包(可选)
----

hene django>;=1.0
django filter>;=1.0.2


快速启动
——


1。安装模块:

pip从外部存储安装django netbox graphql,尚未部署

pip安装dist/django-netbox-graphql-0.0.x.tar.gz


2。将以下模块添加到已安装的应用程序设置中,如下所示:

将石墨烯设置添加到netbox/setting.py::

石墨烯={
"schema":"netbox棼graphql.schema.schema",指向schema.py
"schema棼indent"中的netbox graphql架构变量:2,定义输出中的缩进空间
}


>4。在项目netbox/urls.py中包含轮询urlconf,如下所示:

url(r'^graphql',include('netbox_graphql.urls'),


5。访问http://127.0.0.1:8000/graphql获取带有graphql的记录:

-h"授权:token<;netbox\u token>;""\
-xpost-d'{"查询":"{circuittypes{edges{node{id name slug}}}}}"http://localhost:8000/graphql
访问http://localhost:8000/user/api tokens/以生成令牌

----


-h"授权:token<;netbox-u token>;"\
-xpost-d'{"查询":"变异{newcircuittype(输入:{name:\'type1',slug:\'type1'}{circuittype{id name slug}}}"}"http://localhost:8000/graphql

{"data":{"newcircuittype":{"circuittype":{"id":"q2ly3vpdfr5cgvob2rloji1","name":"type1","slug":"type1"}}}
读取::

-h"授权:令牌<;netbox戥token>;"\
-xpost-d'{"查询":"{circuittypes(id:\"<;circuit type id>;\"){edges{node{id name slug}}}}"}"http://localhost:8000/graphql

{"data":{"circuittypes":{"edges:["node":{"id":"q2ly3vpdfr5cgvob2rloji0,"name":"type","slug":"type"}}}
更新::

-h"授权:token<;netbox\u token>;"\
-xpost-d'{"query":"变异{更新circuittype(输入:{id:\<;电路类型id>;\",名称:\"typex\",slug:\"类型"x\"}{circuittype{slug name slug}}"}http://localhost:8000/graphql

{"data":{"updatecircuittype":{"circuittype":{"id":"q2ly3vpdfr5cgvob2rloji0","name":"typex","slug":"typex"}}}

删除::

-h"授权":token<;netbox\u token>;"\
-xpost-d'{"query":"变异{删除电路类型(输入:{id:\""<;circuit type id>;\"}){circuittype{name slug}}}"}"http://localhost:8000/graphql

{"data":{"deleteecircuittype":{"circuittype":{"name":"typex","slug":"typex"}}}}

graphql编辑器,用于编写查询
您应该已经安装了"graphene-django":

installed-apps=[

"graphene-django",
]


2。通过在"urls.py"中添加新链接为graphql客户端创建url:

url(r'^graphql/client',graphql view.as_view(graphiql=true)),

3。访问http://127.0.0.1:8000/graphql/client::

…图片::https://s11.postimg.org/5vi9lmn1f/django netbox graphql.png


module circuit的示例
-


>所有示例都提供给pypi.python.org打包和部署——
制作和部署包的最简单方法是使用"tween":

pip install tween install tween
python setup.py sdist build django-netbox-graphql-x.x.tar.gz
tween upload dist/django-netbox-graphql-x.x.tar.gz


测试
----
单元测试:

docker compose run netbox./manage.py test运行所有测试e down

pypi distribution
----


可在https://pypi.python.org/pypi上找到?:action=display&;name=django netbox graphql

about
----
此模块当前由"nine<;https://www.nine.ch>;`\u

图片::https://logo.apps.at nine.ch/dmqied_esaobmqwk3vvvgn4uigdo=/trim/500x0/logo_claim.png
:目标:https://nine.ch

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java JPanel不会对键绑定做出反应   当时间大于零时,不得在UI线程上调用java Await   JTextArea的java线程安全。追加   Java用户输入的字和行计数器   java以spreedsheat格式将数据保存到文件中   java构造函数的意义是什么?   java findViewById返回null,尽管组件的ID存在   java如何向按钮添加图像   java如何中断ExecutorService的线程   java如何将属性(例如枚举)绑定到不同类型的组件属性(例如每个枚举的映像)?   随机森林分类器的java实现   html使用java连接到一个站点并发布,HTTP状态代码200   从类访问属性时发生java编译错误   Java自动填充ArrayList,搜索更好的选项