bbbctl 0.1.0__tar.gz → 0.2.0__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.1
2
2
  Name: bbbctl
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: BigBlueButton API command-line client
5
5
  Home-page: https://github.com/defnull/bbbctl
6
6
  Author: Marcel Hellkamp
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = bbbctl
3
- version = 0.1.0
3
+ version = 0.2.0
4
4
  author = Marcel Hellkamp
5
5
  author_email = marc@gsites.de
6
6
  description = BigBlueButton API command-line client
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bbbctl
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: BigBlueButton API command-line client
5
5
  Home-page: https://github.com/defnull/bbbctl
6
6
  Author: Marcel Hellkamp
@@ -6,10 +6,9 @@ import urllib.parse
6
6
  import hashlib
7
7
  import sys, os
8
8
  import xml.etree.ElementTree as ET
9
- from xml.dom import minidom
10
9
  import json
11
10
  import datetime
12
- import re
11
+ import ssl
13
12
 
14
13
  __all__ = ["BBBApiClient", "ApiError"]
15
14
 
@@ -23,9 +22,10 @@ class ApiError(RuntimeError):
23
22
 
24
23
 
25
24
  class BBBApiClient:
26
- def __init__(self, api, secret):
25
+ def __init__(self, api, secret, ssl_context=None):
27
26
  self.api = api.rstrip("/")
28
27
  self.secret = secret
28
+ self.ssl = ssl_context or ssl.create_default_context()
29
29
 
30
30
  def makeurl(self, command, **query):
31
31
  query = urllib.parse.urlencode(query)
@@ -39,7 +39,7 @@ class BBBApiClient:
39
39
 
40
40
  def call(self, command, **query):
41
41
  url = self.makeurl(command, **query)
42
- with urllib.request.urlopen(url) as f:
42
+ with urllib.request.urlopen(url, context=self.ssl) as f:
43
43
  xml = f.read().decode("utf8")
44
44
  root = ET.fromstring(xml)
45
45
  if root.find("./returncode").text != "SUCCESS":
@@ -84,6 +84,10 @@ def build_parser():
84
84
  "--secret",
85
85
  help="API secretd (default: BBBCTL_SECRET or local config)",
86
86
  )
87
+ parser.add_argument(
88
+ "--insecure",
89
+ help="Skip TLS verification and accept self-signed or invalid SSL certificates as if they were valid",
90
+ )
87
91
 
88
92
  parser.add_argument(
89
93
  "--format",
@@ -176,6 +180,7 @@ config_paths = [
176
180
  "/etc/bigbluebutton/bbb-web.properties",
177
181
  "/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties",
178
182
  "/var/lib/tomcat7/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties",
183
+ "./bbbctl.conf",
179
184
  ]
180
185
 
181
186
 
@@ -213,12 +218,17 @@ def main():
213
218
  )
214
219
 
215
220
  server = server.rstrip("/")
216
- if '://' not in server:
221
+ if "://" not in server:
217
222
  server = "https://" + server
218
223
  if not server.endswith("/bigbluebutton/api"):
219
224
  server += "/bigbluebutton/api"
220
225
 
221
- client = BBBApiClient(server, secret)
226
+ ctx = ssl.create_default_context()
227
+ if args.insecure:
228
+ ctx.check_hostname = False
229
+ ctx.verify_mode = ssl.CERT_NONE
230
+
231
+ client = BBBApiClient(server, secret, ssl_context=ctx)
222
232
 
223
233
  try:
224
234
  args.cmd(client, args)
@@ -249,7 +259,7 @@ def format_human(e, indent=""):
249
259
  result = indent + e.tag + ":"
250
260
  if e.tag.lower() in ("starttime", "endtime"):
251
261
  value = "%s (%s)" % (
252
- datetime.datetime.utcfromtimestamp(float(value) / 1000),
262
+ datetime.datetime.fromtimestamp(float(value) / 1000, datetime.timezone.utc),
253
263
  value,
254
264
  )
255
265
  if value:
@@ -278,7 +288,19 @@ def format_json(e, *a, **ka):
278
288
 
279
289
 
280
290
  _should_be_list = ["attendees"]
281
- _should_be_number = ["createTime", "duration", "startTime", "endTime", "participantCount", "listenerCount", "voiceParticipantCount", "videoCount", "maxUsers", "moderatorCount"]
291
+ _should_be_number = [
292
+ "createTime",
293
+ "duration",
294
+ "startTime",
295
+ "endTime",
296
+ "participantCount",
297
+ "listenerCount",
298
+ "voiceParticipantCount",
299
+ "videoCount",
300
+ "maxUsers",
301
+ "moderatorCount",
302
+ ]
303
+
282
304
 
283
305
  def _unpack_xml(e):
284
306
  if e.tag in _should_be_list:
@@ -290,8 +312,8 @@ def _unpack_xml(e):
290
312
  return int(value)
291
313
  if not value:
292
314
  return None
293
- if value in ('true', 'false'):
294
- return value == 'true'
315
+ if value in ("true", "false"):
316
+ return value == "true"
295
317
  return value
296
318
 
297
319
 
@@ -351,6 +373,7 @@ def cmd_meet_create(api, args):
351
373
  link = api.getJoinLink(
352
374
  meetingID=args.id,
353
375
  fullName=name,
376
+ createTime=created.find("createTime").text,
354
377
  password=created.find("moderatorPW").text,
355
378
  )
356
379
  print(name + ":", link)
@@ -365,6 +388,7 @@ def cmd_meet_join(api, args):
365
388
 
366
389
  if args.open:
367
390
  import webbrowser
391
+
368
392
  webbrowser.open_new_tab(link)
369
393
  else:
370
394
  print(link)
File without changes
File without changes
File without changes