#!/usr/bin/env python3

from rc.clients import APIClient

if __name__ == '__main__':
  """
  Lists all the usernames of Users
  who have used the Drill Press.
  """

  # If the bash variables RC_PUBLIC_KEY and RC_PRIVATE_KEY 
  # are not set you need to pass the public and private key
  # values into this constructor
  client = APIClient()

  tooltron_id = client.projects(name="Tooltron")[0]['id']

  api_requests = client.api_requests(endpoint='/rfid/', updater_is_project=True, updater_id=tooltron_id, meta="Drill Press")

  for api_request in api_requests:
    user_id = api_request['user']

    if user_id:
      user = client.user(id=user_id)
      print("{} was {} access on Drill Press from {} until {}".format(user['username'], "Granted" if api_request['success'] else "Denied", api_request['created_datetime'], api_request['updated_datetime']))
Ejemplo n.º 2
0
#!/usr/bin/env python3

from rc.clients import APIClient

if __name__ == '__main__':
  """
  Lists all the usernames of Users
  who have used the CardReader project.
  """

  # If the bash variables RC_PUBLIC_KEY and RC_PRIVATE_KEY 
  # are not set you need to pass the public and private key
  # values into this constructor
  client = APIClient()

  cardreader_id = client.projects(name="CardReader")[0]['id']

  api_requests = client.api_requests(endpoint='/magnetic/', updater_is_project=True, updater_id=cardreader_id)

  for api_request in api_requests:
    user_id = api_request['user']

    if user_id:
      user = client.user(id=user_id)
      print("{} used CardReader on {}".format(user['username'], api_request['created_datetime']))
Ejemplo n.º 3
0
#!/usr/bin/env python3.4

from rc.clients import APIClient
import sys

if __name__ == '__main__':
  # If the base variables RC_PUBLIC_KEY and RC_PRIVATE_KEY 
  # are not set you need to pass the public and private key
  # values into this constructor
  client = APIClient()

  username = input("Username: "******"Invalid username")
  else:
    user = users[0]
    
    user_id = user['id']
    projects = client.projects(leaders=user_id)

    for project in projects:
      print(project['name'])
Ejemplo n.º 4
0
 def test_projects(self):
   client = APIClient()
   self.assertGreaterEqual(len(client.projects()), 1)