Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Verefa client side package for sending and receiving data from the Verefa database system.
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.
FAQs
Verefa client side package for sending and receiving data from the Verefa database system.
We found that verefa demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.