You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
5.9 KiB
5.9 KiB
<html>
<head>
</head>
</html>
In [1]:
# <!-- base64("username:password") -->
import base64
encoded = base64.b64encode(b'username:password')
print(encoded)
b'ZG9uYWxkcmljaDppYmFuZXo2OQ=='
In [22]:
# import sys
!{sys.executable} -m pip install kinto-wizard kinto-http
# import builtinsss
import io
import os
# import pytest
# import unittest
# import sys
# from contextlib import contextmanager, redirect_stdout
import yaml
import requests
from kinto_http import Client, exceptions
from kinto_wizard.__main__ import main
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: kinto-wizard in /home/donaldrich/.local/lib/python3.8/site-packages (4.0.1)
Requirement already satisfied: kinto-http in /home/donaldrich/.local/lib/python3.8/site-packages (10.7.0)
Requirement already satisfied: unidecode in /home/donaldrich/.local/lib/python3.8/site-packages (from kinto-http) (1.2.0)
Requirement already satisfied: requests>=2.8.1 in /usr/lib/python3/dist-packages (from kinto-http) (2.22.0)
Requirement already satisfied: ruamel.yaml in /home/donaldrich/.local/lib/python3.8/site-packages (from kinto-wizard) (0.17.16)
Requirement already satisfied: jsonschema in /usr/lib/python3/dist-packages (from kinto-wizard) (3.2.0)
Requirement already satisfied: ruamel.yaml.clib>=0.1.2 in /home/donaldrich/.local/lib/python3.8/site-packages (from ruamel.yaml->kinto-wizard) (0.2.6)
WARNING: You are using pip version 21.0.1; however, version 21.2.4 is available.
You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.
Export Schema¶
In [ ]:
stream = os.popen(
'kinto-wizard dump --data --server http://kinto:8888/v1 --auth username:password'
)
output = stream.read()
yaml_out = yaml.load(output, Loader=yaml.FullLoader)
with open(r'dump.yaml', 'w') as file:
documents = yaml.dump(yaml_out, file)
Upload¶
In [24]:
import yaml
with open(r'full.yaml', 'r') as file:
documents = yaml.load(file, Loader=yaml.FullLoader)
--------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) <ipython-input-24-13c58aac364e> in <module> 1 import yaml 2 ----> 3 with open(r'full.yaml', 'r') as file: 4 documents = yaml.load(file, Loader=yaml.FullLoader) FileNotFoundError: [Errno 2] No such file or directory: 'full.yaml'
In [ ]:
# import sys
# !{sys.executable} -m pip install kinto-wizard kinto-http
import os
stream = os.popen(
'kinto-wizard load --server http://kinto:8888/v1 --auth username:password upload.yaml'
)
In [ ]: