bbbctl 0.4.1__tar.gz → 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bbbctl
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: BigBlueButton API command-line client
5
5
  Author-email: Marcel Hellkamp <marc@gsites.de>
6
6
  Requires-Python: >=3.6
@@ -17,14 +17,10 @@ Project-URL: Homepage, https://github.com/defnull/bbbctl
17
17
  This is a small but useful command-line client for controlling meetings and recordings on
18
18
  a [BigBlueButton](https://docs.bigbluebutton.org/) server or cluster directly via the
19
19
  [REST API](https://docs.bigbluebutton.org/dev/api.html). It allows administrators to bypass
20
- front-end applications ([greenlight](https://github.com/bigbluebutton/greenlight),
21
- [moodle](https://moodle.com/certified-integrations/bigbluebutton/) or alternatives) and
20
+ front-end applications (e.g. [greenlight](https://github.com/bigbluebutton/greenlight) or
21
+ [moodle](https://moodle.com/certified-integrations/bigbluebutton/)) and
22
22
  directly access the backing BBB servers for administrative tasks, monitoring or testing.
23
23
 
24
- The module can also be imported as a python library, but please note that this project is
25
- not yet considered stable in any way. A stable and more usable API for python scripting
26
- might follow.
27
-
28
24
  ## Install
29
25
 
30
26
  You can install bbbctl the usual way with `pip install bbbctl` into a virtual environment.
@@ -51,7 +47,6 @@ export BBBCTL_SECRET="..." # or --secret as a parameter
51
47
 
52
48
  # Check if your secret works:
53
49
  bbbctl meeting list
54
-
55
50
  ```
56
51
 
57
52
  ## Command overview
@@ -80,6 +75,21 @@ The default output format is a human readable plain text format. You can switch
80
75
  compact version with `--format=compact`. Other formats that are better suited for scripted
81
76
  usage are also supported: `json`, `jsonline` or `xml`
82
77
 
78
+ ## Use `BBBApiClient` from Python
79
+
80
+ You can use the `BBBApiClient` class from Python, too. This thin wrapper around the
81
+ BBB REST API can send signed API requests and return parsed XML `ElementTree`
82
+ instances. Some convenience methods exist to get just the part of the XML you need.
83
+
84
+ ```python
85
+ from bbbctl import BBBApiClient
86
+
87
+ client = BBBApiClient(api="bbb.example.com", secret="***")
88
+
89
+ for meeting in client.getMeetings():
90
+ print(meeting.findtext("./meetingID"), meeting.findtext("./meetingName"))
91
+ ```
92
+
83
93
  # License
84
94
 
85
95
  Copyright (c) 2020-2062, Marcel Hellkamp.
@@ -3,14 +3,10 @@
3
3
  This is a small but useful command-line client for controlling meetings and recordings on
4
4
  a [BigBlueButton](https://docs.bigbluebutton.org/) server or cluster directly via the
5
5
  [REST API](https://docs.bigbluebutton.org/dev/api.html). It allows administrators to bypass
6
- front-end applications ([greenlight](https://github.com/bigbluebutton/greenlight),
7
- [moodle](https://moodle.com/certified-integrations/bigbluebutton/) or alternatives) and
6
+ front-end applications (e.g. [greenlight](https://github.com/bigbluebutton/greenlight) or
7
+ [moodle](https://moodle.com/certified-integrations/bigbluebutton/)) and
8
8
  directly access the backing BBB servers for administrative tasks, monitoring or testing.
9
9
 
10
- The module can also be imported as a python library, but please note that this project is
11
- not yet considered stable in any way. A stable and more usable API for python scripting
12
- might follow.
13
-
14
10
  ## Install
15
11
 
16
12
  You can install bbbctl the usual way with `pip install bbbctl` into a virtual environment.
@@ -37,7 +33,6 @@ export BBBCTL_SECRET="..." # or --secret as a parameter
37
33
 
38
34
  # Check if your secret works:
39
35
  bbbctl meeting list
40
-
41
36
  ```
42
37
 
43
38
  ## Command overview
@@ -66,6 +61,21 @@ The default output format is a human readable plain text format. You can switch
66
61
  compact version with `--format=compact`. Other formats that are better suited for scripted
67
62
  usage are also supported: `json`, `jsonline` or `xml`
68
63
 
64
+ ## Use `BBBApiClient` from Python
65
+
66
+ You can use the `BBBApiClient` class from Python, too. This thin wrapper around the
67
+ BBB REST API can send signed API requests and return parsed XML `ElementTree`
68
+ instances. Some convenience methods exist to get just the part of the XML you need.
69
+
70
+ ```python
71
+ from bbbctl import BBBApiClient
72
+
73
+ client = BBBApiClient(api="bbb.example.com", secret="***")
74
+
75
+ for meeting in client.getMeetings():
76
+ print(meeting.findtext("./meetingID"), meeting.findtext("./meetingName"))
77
+ ```
78
+
69
79
  # License
70
80
 
71
81
  Copyright (c) 2020-2062, Marcel Hellkamp.
@@ -6,7 +6,7 @@ build-backend = "flit_core.buildapi"
6
6
 
7
7
  [project]
8
8
  name = "bbbctl"
9
- version = "0.4.1"
9
+ version = "0.4.2"
10
10
  description = "BigBlueButton API command-line client"
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.6"
@@ -336,6 +336,13 @@ class ApiError(RuntimeError):
336
336
 
337
337
  class BBBApiClient:
338
338
  def __init__(self, api, secret, ssl_context=None, debug=0):
339
+ # Add scheme if missing
340
+ if "://" not in api:
341
+ api = "https://" + api
342
+ # Add default API path, but only if there is no path yet
343
+ if api.count("/") == 2:
344
+ api += "/bigbluebutton/api"
345
+
339
346
  self.api = api.rstrip("/")
340
347
  self.secret = secret
341
348
  self.ssl = ssl_context or ssl.create_default_context()
@@ -367,7 +374,9 @@ class BBBApiClient:
367
374
  raise ApiError(root)
368
375
  return root
369
376
 
370
- def getJoinLink(self, **query):
377
+ def getJoinLink(self, meetingID, fullName, **query):
378
+ query["meetingID"] = meetingID
379
+ query["fullName"] = fullName
371
380
  return self.makeurl("join", **query)
372
381
 
373
382
  def getMeetings(self, **query):
@@ -376,13 +385,17 @@ class BBBApiClient:
376
385
  def getRecordings(self, **query):
377
386
  return self.call("getRecordings", **query).findall("./recordings/recording")
378
387
 
379
- def getMeetingInfo(self, **query):
388
+ def getMeetingInfo(self, meetingID, **query):
389
+ query["meetingID"] = meetingID
380
390
  return self.call("getMeetingInfo", **query)
381
391
 
382
- def createMeeting(self, **query):
392
+ def createMeeting(self, meetingID, name, **query):
393
+ query["meetingID"] = meetingID
394
+ query["name"] = name
383
395
  return self.call("create", **query)
384
396
 
385
- def end(self, **query):
397
+ def end(self, meetingID, **query):
398
+ query["meetingID"] = meetingID
386
399
  return self.call("end", **query)
387
400
 
388
401
  def publishRecordings(self, recordID, publish):
@@ -644,12 +657,6 @@ def main():
644
657
  )
645
658
  )
646
659
 
647
- server = server.rstrip("/")
648
- if "://" not in server:
649
- server = "https://" + server
650
- if not server.endswith("/bigbluebutton/api"):
651
- server += "/bigbluebutton/api"
652
-
653
660
  ctx = ssl.create_default_context()
654
661
  if args.insecure:
655
662
  ctx.check_hostname = False
File without changes