Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
This is the Software Development Kit (SDK) for Python, which allows Python developers to write software that makes use of AnyMotion. It works on Python 3.6 or greater.
Install using pip:
$ pip install anymotion-sdk
If you want to use a CV-based methods:
$ pip install anymotion-sdk[cv]
To use AnyMotion Python SDK, you must first import it and tell it about your credentials which issued by the AnyMotion Portal:
import anymotion_sdk
# Setup client
client = anymotion_sdk.Client(client_id="your_client_id", client_secret="your_client_secret")
You can also use environment variables:
export ANYMOTION_CLIENT_ID=<your_client_id>
export ANYMOTION_CLIENT_SECRET=<your_client_secret>
# Setup client using environment variables
client = anymotion_sdk.Client()
The following is how to upload an image and extract the keypoints:
# Upload image file
upload_result = client.upload("image.jpg")
# Extract keypoint
keypoint_id = client.extract_keypoint(image_id=upload_result.image_id)
extraction_result = client.wait_for_extraction(keypoint_id)
# Get keypoint data from result
keypoint = extraction_result.json
You can get the uploaded data or the keypoint extracted data and so on as follows:
# Get data of a specific id
image = client.get_image(image_id)
movie = client.get_movie(movie_id)
keypoint = client.get_keypoint(keypoint_id)
drawing = client.get_drawing(drawing_id)
analysis = client.get_analysis(analysis_id)
comparison = client.get_comparison(comparison_id)
# Get all data
images = client.get_images()
movies = client.get_movies()
keypoints = client.get_keypoints()
drawings = client.get_drawings()
analyses = client.get_analyses()
comparisons = client.get_comparisons()
In get_keypoint
, get_drawing
, get_analysis
, and get_comparison
, you can use the join_data
option to get the relevant data at the same time.
>>> client.get_keypoint(keypoint_id)
{'id': 1, 'image': 2, 'movie': None, 'keypoint': [{'nose': [10, 20]}], 'execStatus': 'SUCCESS', 'failureDetail': None, 'createdAt': '2020-01-01T00:00:00.000000Z', 'updatedAt': '2020-01-01T00:00:00.000000Z'}
>>> client.get_keypoint(keypoint_id, join_data=True)
{'id': 1, 'image': {'id': 2, 'name': 'image', 'text': '', 'height': 100, 'width': 100, 'contentMd5': 'ecWkdCSrnBa9+EYREt/fbg==', 'createdAt': '2020-01-01T00:00:00.000000Z', 'updatedAt': '2020-01-01T00:00:00.000000Z'}, 'movie': None, 'keypoint': [{'nose': [10, 20]}], 'execStatus': 'SUCCESS', 'failureDetail': None, 'createdAt': '2020-01-01T00:00:00.000000Z', 'updatedAt': '2020-01-01T00:00:00.000000Z'}
The way to output the log to stdout is as follows:
# Log level is INFO by default.
anymotion_sdk.set_stream_logger()
# Set the log level to DEBUG.
# At the DEBUG level, the content of the request and response to the API is output.
anymotion_sdk.set_stream_logger(level=logging.DEBUG)
For more examples, see here.
If you install the extra package, download_and_read
is available.
download_and_read
returns the downloaded image or video in numpy format.
data = client.download_and_read(drawing_id)
Warning: Large videos use a lot of RAM.
See CHANGELOG.md.
FAQs
AnyMotion SDK for Python
We found that anymotion-sdk 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.