Skip to content

Conversation

@Ryanf55
Copy link

@Ryanf55 Ryanf55 commented Sep 2, 2023

Purpose

This is a simple python example to get the devices, modeled after the python example here: https://docs.remote.it/developer-tools/authentication#api-request-signing

Current Issues

  1. It doesn't work with the latest version of requests_http_signature, which has had breaking changes. The remote.it docs say to use 0.1.0. I'd love to use newer if possible, but need some advise on if remoteit will support the new draft standard.
  2. I intended to get this to drill down into the SSH connections, to report the active SSH connections by device, but that doesn't seem possible. Since this already does something useful in python, I thought to put it up for review. The request for querying current connections is here: https://forum.remote.it/t/api-for-getting-active-connections-by-device/916
  3. The python code is formatted with black right now. Can we enforce that in CI with pre-commit or another tool?

Demo

ryan@ryan:~/Development/code_samples/sample_apps/python-ssh-connection-config$ ./run_query.py 
data:
  login:
    devices:
      items:
      - id: AA:BB:CC:DD:EE:FF
        name: ryan-B650-970
        state: active
      - id: 90:00:00:00:00:03:9C:1D
        name: ubuntu
        state: inactive
    email: myemail@gmail.com
    id: XX-YY-ZZQQRRSSSTT

* Later, it will support getting SSH information

Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Copy link
Contributor

@bstrech bstrech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ryanf55 Thank you for the contribution! Sorry for the late review.
Some quick notes. We did make some fixes for python httpsignatureauth to bring it up to date.
You also should add to your query total and hasMore for users with more than 1000 devices. I realize I should add some more to documentation to explain how to iterate to fetch more if there are more. See https://docs.remote.it/developer-tools/api/usage#pagination

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants