You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.8 KiB
HTML
76 lines
2.8 KiB
HTML
<script>
|
|
$(document).ready(()=>{
|
|
qcms.source_code()
|
|
})
|
|
</script>
|
|
<div>
|
|
<div class="large-text">Initialize registry</div>
|
|
<p> <b>data-transport</b> uses a registry to store database authentication information and referenced by a human readable label.
|
|
<ul style="list-style: none;">
|
|
<li> <i class="fa-solid fa-minus"></i> The labels reference are recommended instead of having username,passwords ... hard coded</li>
|
|
<li> <i class="fa-solid fa-minus"></i> This makes sharing notebooks (Jupyter, Zeppelin, ...) without dissipating sensitive information, making this a solution to improve collaboration</li>
|
|
</ul>
|
|
</p>
|
|
<div class="bold">Initialize Registry</div>
|
|
<p>
|
|
The registry can be initialized through the command line (CLI) or in code.
|
|
<br>A folder will be created in your home folder <b>$HOME/.data-transport/transport-registry.json</b>
|
|
</p>
|
|
<p>
|
|
<div style="display:grid; grid-template-columns: 50% 50%; gap:4px">
|
|
<div>
|
|
<b>Command line (CLI)</b>
|
|
<p>
|
|
|
|
<div class="source-code">
|
|
# creates folders and files needed
|
|
<br>$ transport registry reset < your email >
|
|
</div>
|
|
|
|
<p>
|
|
Create a file <b>http-auth.json</b> and it should contain the following
|
|
<div class="source-code">
|
|
{<br>"provider":"http",
|
|
|
|
"url":"https://raw.githubusercontent.com/codeforamerica/ohana-api/master/data/sample-csv/addresses.csv"
|
|
|
|
<br>}
|
|
</div>
|
|
</p>
|
|
|
|
Add the created file <b>http-auth.json</b> to the registry under the label <b>address-db</b>
|
|
<div class="source-code">
|
|
$ transport registry --add address-db http-auth.json
|
|
</div>
|
|
|
|
</p>
|
|
</p>
|
|
</div>
|
|
|
|
<div style="border-left:4px dotted #CAD5E0; padding-left:8px;">
|
|
<b>In code</b>
|
|
<p>
|
|
<div class="source-code">
|
|
<b>import</b> transport
|
|
<br><b>import</b> io
|
|
<br><b>import</b> json
|
|
<br>#
|
|
<br># transport.registry.exists()
|
|
<br>_email = 'steve@the-phi.com'
|
|
<br>transport.registry.init(_email)
|
|
|
|
<br><br>#
|
|
<br># Adding the entry to the registry now that is initialized
|
|
<br>_authStr = {"provider":"http",
|
|
"url":"https://raw.githubusercontent.com/codeforamerica/ohana-api/master/data/sample-csv/addresses.csv"
|
|
}
|
|
<br>file = io.StringIO(json.dumps(_authStr))
|
|
<br>transport.registry.set('address-db',file)
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</p>
|
|
</div> |