Verefa client side package for sending and receiving data from the Verefa database system.
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
VEREFA CLIENT PACKAGE
THIS SOFTWARE IS PROTECTED BY THE MIT LICENSE
REQUIREMENTS:
REQUESTS MODULE
CHANGES
Machine setup supports debug, default False,
client=verefa.machine(debug=True)Connect collects important security data and warns if unable to collect.
FUNCTIONS
client.connect()
client.send()
client.get()
client.iterate()
client.purge()
EXAMPLE SETUP
STEP1:
Visit https://verefa.com/ and register as a developer, here you must click "New App" and copy the "token" and "tokenid"
STEP2:
Install verefa as shown below.
pip install verefa
STEP3:
Create a python client as shown below.
import verefa
client=verefa.machine()
client.connect(TOKENID,TOKEN,"APPNAME")
Ensure you substitute the values from your developer portal into the above connect statement.
STORING DATA:
Begin storing data as shown below.
data = {
"Name":"Marcus",
"Email":"marcus@demomail.com"
}
response = client.send("tablename/document", data)
Send Rules:
Data must be created as a dictionary The location must not begin or end with
/The paths in a send/get statement must be even.
GETTING DATA:
response = client.get("tablename/document")
Get Rules:
Data returned will be in dictionary format. You can specify parameters
client.get("tablename/document", "Name")This would call all documents which include the "Name" field
EXAMPLE:
import verefa
client=verefa.machine()
client.connect(123,34982,1)
print("DEMONSTRATION")
userdict = {
"name":"Daniel",
"email":"daniel@gmail.com"
}
response = client.send(f"users/2", userdict)
print(response)
#prints success message
data = client.get(f"users/2")
print(data)
#prints dictionary of data previously submitted
print(data["name"])
#prints the value of field "name"
documents = client.iterate(f"users")
print(documents)
#prints a dictionary with embedded dictionaries for each user document in the table of users.
result = client.purge(f"users/mike", "FIELD", "email")
#deletes the field "email" in the document "mike"
result = client.purge(f"users/mike", "DOC")
#deletes the document "mike" and the document's data, but not the documents or directories mike held.
result = client.purge(f"users", "ALL")
#deletes the table users and all the content beneath it, does not delete content which is hidden
WARNINGS:
You can't have locations with an odd number of positions unless using .iteration():
client.send(f"users/bob/rewards", userdict)THIS IS WRONG AND WILL ERRORclient.get(f"users/bob/rewards")THIS IS WRONG AND WILL ERROR
client.send(f"users/bob/rewards/recent", userdict)THIS IS CORRECT AND WILL FUNCTIONclient.get(f"users/bob/rewards/recent")THIS IS CORRECT AND WILL FUNCTION
FAQ's:
What is "hidden" data?
When you delete a document using client.purge(f"users/mike", "DOC") all other documents and directories under the "mike" document are not deleted, they are known as "hidden" data, and can only be manually deleted by specifically deleting each path.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file verefa-1.2.2.tar.gz.
File metadata
- Download URL: verefa-1.2.2.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99f9c9d11e5c83250f12df0c4118e8c483b919e64a5dcc6189aee981e775d304
|
|
| MD5 |
db6906fe9e8310f3c96de671b1234547
|
|
| BLAKE2b-256 |
bdb3513ce9da8043d8b9bb6928d02cf917f0ed155ae0973f54abc34258f9fe8d
|