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.
Basic Python-based data server for exposing flat table and object hierarchy files via REST-ful queries
You know what's awesome? Setting up a REST-ful server you can start with a single command, out-of-the-box.
You know what's even cooler? Adding file resources to that server just by dragging and dropping said files into a folder.
Welcome to pyroclast.
To start a Pyroclast instance, simply point the Python interpreter to the server.py file:
::
python server.py
Alternatively, you can import server and start an instance manually from within Python:
::
from pyroclast import server
server.start()
Once the server is started, you will see a blank HTTP response for 127.0.0.1:1337. This means it's working!
Within the Pyroclast package, the 'data/' folder contains all files your server will host. This can include:
To add a file, simply copy it into the Pyroclast package's 'data/' folder and the Pyroclast server will do the rest.
Alternatively, you can serve a file procedurally using the data module's serve() function, which will copy directory contents into 'data/':
::
from pyroclast import data
data.serve('/path/to/my/file.xlsx')
Once your server is up and running, you can query files from a URL based on the file path relative to 'data/'--i.e., if 'test.xlsx' is in 'data/', it is accessed by the URL 'http://127.0.0.1:1337/test.xlsx'.
All data queried will be returned in one of two formats:
Specific subsets of data from a source can be selected using the query segment of the URL (i.e., ?key=value&key2=value2). In addition to down-selecting the returned data set based on attribute key-value pairs, there are several format-specific keys that can be used. (Note that there are no format-specific keys for .JSON, .XML, and .CSV formats).
Excel spreadsheets can contain multiple sheets. Pyroclast assumes each queried sheet is a flat table starting from the first row (a header) and first column. Specific sheets can be selected in one of two ways:
In cases where no '_sheet' value is given, Pyroclast will default to the first sheet in the file.
In cases where sheets are given integer values as names, Pyroclast will default to the string interpretation.
SQLite database files require a query indicate a specific table. This is done by passing the desired table name as a value of the '_table' key. If the '_table' key is not specified, an error will be raised.
UnQLite is a funny beast. .UNQ database files can contain both key-value pairs AND collections of related object hierarchies.
If neither '_collection' or '_key' is indicated, Pyroclast will return all contents of the database. Key-value pairs will be included in the response twice:
FAQs
Basic Python-based data server for exposing flat table and object hierarchy files via REST-ful queries
We found that pyroclast 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.