-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathoctav.py
3964 lines (3683 loc) · 148 KB
/
octav.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""OCTAV Client Library"""
"""DO NOT EDIT: This file was generated from ../spec/v2/api.json on Fri Apr 21 07:10:38 2017"""
import certifi
import feedparser
import functools
import json
import os
import re
import time
import urllib3
if os.getenv('SERVER_SOFTWARE', '').startswith('Google App Engine/') or os.getenv('SERVER_SOFTWARE', '').startswith('Development/'):
from urllib3.contrib.appengine import AppEngineManager as PoolManager
else:
from urllib3 import PoolManager
import sys
if sys.version[0] == "3":
from urllib.parse import urlencode
else:
from urllib import urlencode
class MissingRequiredArgument(Exception):
pass
def parse_rfc3339(s):
return time.mktime(feedparser._parse_date(s))
class Session(object):
def __init__(self, client, f, sid, expires):
if not f:
raise MissingRequiredArgument('f is required')
if not client:
raise MissingRequiredArgument('client is required')
if not sid:
raise MissingRequiredArgument('sid is required')
if not expires:
raise MissingRequiredArgument('expires is required')
self.update_func = f
self.sid = sid
self.expires = expires
self.client = client
def last_error(self):
return self.client.last_error()
# renews the octav session. returns false if there was no need to
# renew, true if the session was renewed. None is returned if
# there was an error
def renew(self):
if self.expires > time.mktime(time.gmtime()):
return False
s = self.update_func()
if s is None:
return None
self.sid = s.get('sid')
self.expires = parse_rfc3339(s.get('expires'))
return True
def add_conference_admin (self, admin_id, conference_id, extra_headers=None):
self.renew()
return self.client.add_conference_admin(admin_id, conference_id, extra_headers={'X-Octav-Session-ID': self.sid})
def add_conference_credential (self, conference_id, data, type, extra_headers=None):
self.renew()
return self.client.add_conference_credential(conference_id, data, type, extra_headers={'X-Octav-Session-ID': self.sid})
def add_conference_date (self, conference_id, date, extra_headers=None):
self.renew()
return self.client.add_conference_date(conference_id, date, extra_headers={'X-Octav-Session-ID': self.sid})
def add_conference_series_admin (self, admin_id, series_id, extra_headers=None):
self.renew()
return self.client.add_conference_series_admin(admin_id, series_id, extra_headers={'X-Octav-Session-ID': self.sid})
def add_conference_staff (self, conference_id, staff_id, extra_headers=None):
self.renew()
return self.client.add_conference_staff(conference_id, staff_id, extra_headers={'X-Octav-Session-ID': self.sid})
def add_conference_venue (self, conference_id, venue_id, extra_headers=None):
self.renew()
return self.client.add_conference_venue(conference_id, venue_id, extra_headers={'X-Octav-Session-ID': self.sid})
def add_featured_speaker (self, conference_id, description, display_name, avatar_url=None, speaker_id=None, extra_headers=None, **args):
self.renew()
return self.client.add_featured_speaker(conference_id, description, display_name, avatar_url=avatar_url, speaker_id=speaker_id, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def add_session_type (self, abstract, conference_id, duration, name, submission_end=None, submission_start=None, extra_headers=None, **args):
self.renew()
return self.client.add_session_type(abstract, conference_id, duration, name, submission_end=submission_end, submission_start=submission_start, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def add_sponsor (self, conference_id, group_name, name, url, logo_url=None, sort_order=None, extra_headers=None, **args):
self.renew()
return self.client.add_sponsor(conference_id, group_name, name, url, logo_url=logo_url, sort_order=sort_order, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def confirm_temporary_email (self, confirmation_key, target_id, extra_headers=None):
self.renew()
return self.client.confirm_temporary_email(confirmation_key, target_id, extra_headers={'X-Octav-Session-ID': self.sid})
def create_blog_entry (self, conference_id, url, status=None, title=None, extra_headers=None):
self.renew()
return self.client.create_blog_entry(conference_id, url, status=status, title=title, extra_headers={'X-Octav-Session-ID': self.sid})
def create_client_session (self, access_token, auth_via, extra_headers=None):
self.renew()
return self.client.create_client_session(access_token, auth_via, extra_headers={'X-Octav-Session-ID': self.sid})
def create_conference (self, series_id, slug, title, cfp_lead_text=None, cfp_post_submit_instructions=None, cfp_pre_submit_instructions=None, contact_information=None, description=None, sub_title=None, timezone=None, extra_headers=None, **args):
self.renew()
return self.client.create_conference(series_id, slug, title, cfp_lead_text=cfp_lead_text, cfp_post_submit_instructions=cfp_post_submit_instructions, cfp_pre_submit_instructions=cfp_pre_submit_instructions, contact_information=contact_information, description=description, sub_title=sub_title, timezone=timezone, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def create_conference_series (self, session, slug, title, description=None, sid=None, extra_headers=None):
self.renew()
return self.client.create_conference_series(session, slug, title, description=description, sid=sid, extra_headers={'X-Octav-Session-ID': self.sid})
def create_external_resource (self, conference_id, title, url, description=None, image_url=None, sort_order=None, extra_headers=None, **args):
self.renew()
return self.client.create_external_resource(conference_id, title, url, description=description, image_url=image_url, sort_order=sort_order, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def create_question (self, body, session_id, extra_headers=None):
self.renew()
return self.client.create_question(body, session_id, extra_headers={'X-Octav-Session-ID': self.sid})
def create_room (self, name, venue_id, capacity=None, extra_headers=None, **args):
self.renew()
return self.client.create_room(name, venue_id, capacity=capacity, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def create_session (self, conference_id, session_type_id, speaker_id, abstract=None, category=None, material_level=None, materials_release=None, memo=None, photo_release=None, recording_release=None, slide_language=None, slide_subtitles=None, slide_url=None, spoken_language=None, tags=None, title=None, video_url=None, extra_headers=None, **args):
self.renew()
return self.client.create_session(conference_id, session_type_id, speaker_id, abstract=abstract, category=category, material_level=material_level, materials_release=materials_release, memo=memo, photo_release=photo_release, recording_release=recording_release, slide_language=slide_language, slide_subtitles=slide_subtitles, slide_url=slide_url, spoken_language=spoken_language, tags=tags, title=title, video_url=video_url, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def create_session_survey_response (self, material_quality, overall_rating, session_id, speaker_knowledge, speaker_presentation, user_prior_knowledge, comment_good=None, comment_improvement=None, extra_headers=None):
self.renew()
return self.client.create_session_survey_response(material_quality, overall_rating, session_id, speaker_knowledge, speaker_presentation, user_prior_knowledge, comment_good=comment_good, comment_improvement=comment_improvement, extra_headers={'X-Octav-Session-ID': self.sid})
def create_temporary_email (self, email, target_id, extra_headers=None):
self.renew()
return self.client.create_temporary_email(email, target_id, extra_headers={'X-Octav-Session-ID': self.sid})
def create_track (self, conference_id, room_id, name=None, sort_order=None, extra_headers=None, **args):
self.renew()
return self.client.create_track(conference_id, room_id, name=name, sort_order=sort_order, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def create_user (self, auth_user_id, auth_via, nickname, avatar_url=None, email=None, first_name=None, lang=None, last_name=None, tshirt_size=None, extra_headers=None, **args):
self.renew()
return self.client.create_user(auth_user_id, auth_via, nickname, avatar_url=avatar_url, email=email, first_name=first_name, lang=lang, last_name=last_name, tshirt_size=tshirt_size, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def create_venue (self, address, name, latitude=None, longitude=None, place_id=None, url=None, extra_headers=None, **args):
self.renew()
return self.client.create_venue(address, name, latitude=latitude, longitude=longitude, place_id=place_id, url=url, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def delete_blog_entry (self, id, extra_headers=None):
self.renew()
return self.client.delete_blog_entry(id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_conference (self, id, extra_headers=None):
self.renew()
return self.client.delete_conference(id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_conference_admin (self, admin_id, conference_id, extra_headers=None):
self.renew()
return self.client.delete_conference_admin(admin_id, conference_id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_conference_date (self, conference_id, date, extra_headers=None):
self.renew()
return self.client.delete_conference_date(conference_id, date, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_conference_series (self, id, extra_headers=None):
self.renew()
return self.client.delete_conference_series(id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_conference_staff (self, conference_id, staff_id, extra_headers=None):
self.renew()
return self.client.delete_conference_staff(conference_id, staff_id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_conference_venue (self, conference_id, venue_id, extra_headers=None):
self.renew()
return self.client.delete_conference_venue(conference_id, venue_id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_external_resource (self, id, extra_headers=None):
self.renew()
return self.client.delete_external_resource(id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_featured_speaker (self, id, extra_headers=None):
self.renew()
return self.client.delete_featured_speaker(id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_question (self, id, extra_headers=None):
self.renew()
return self.client.delete_question(id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_room (self, id, extra_headers=None):
self.renew()
return self.client.delete_room(id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_session (self, id, extra_headers=None):
self.renew()
return self.client.delete_session(id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_session_type (self, id, extra_headers=None):
self.renew()
return self.client.delete_session_type(id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_sponsor (self, id, extra_headers=None):
self.renew()
return self.client.delete_sponsor(id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_track (self, id, extra_headers=None):
self.renew()
return self.client.delete_track(id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_user (self, id, extra_headers=None):
self.renew()
return self.client.delete_user(id, extra_headers={'X-Octav-Session-ID': self.sid})
def delete_venue (self, id, extra_headers=None):
self.renew()
return self.client.delete_venue(id, extra_headers={'X-Octav-Session-ID': self.sid})
def get_conference_schedule (self, conference_id, lang=None, extra_headers=None):
self.renew()
return self.client.get_conference_schedule(conference_id, lang=lang, extra_headers={'X-Octav-Session-ID': self.sid})
def health_check (self, extra_headers=None):
self.renew()
return self.client.health_check(extra_headers={'X-Octav-Session-ID': self.sid})
def list_blog_entries (self, conference_id=None, lang=None, status=None, extra_headers=None):
self.renew()
return self.client.list_blog_entries(conference_id=conference_id, lang=lang, status=status, extra_headers={'X-Octav-Session-ID': self.sid})
def list_conference (self, lang=None, limit=None, organizers=None, range_end=None, range_start=None, since=None, status=None, extra_headers=None):
self.renew()
return self.client.list_conference(lang=lang, limit=limit, organizers=organizers, range_end=range_end, range_start=range_start, since=since, status=status, extra_headers={'X-Octav-Session-ID': self.sid})
def list_conference_admin (self, conference_id, extra_headers=None):
self.renew()
return self.client.list_conference_admin(conference_id, extra_headers={'X-Octav-Session-ID': self.sid})
def list_conference_date (self, conference_id, extra_headers=None):
self.renew()
return self.client.list_conference_date(conference_id, extra_headers={'X-Octav-Session-ID': self.sid})
def list_conference_series (self, limit=None, since=None, extra_headers=None):
self.renew()
return self.client.list_conference_series(limit=limit, since=since, extra_headers={'X-Octav-Session-ID': self.sid})
def list_conference_staff (self, conference_id=None, lang=None, extra_headers=None):
self.renew()
return self.client.list_conference_staff(conference_id=conference_id, lang=lang, extra_headers={'X-Octav-Session-ID': self.sid})
def list_conferences_by_organizer (self, lang=None, limit=None, organizer_id=None, since=None, status=None, extra_headers=None):
self.renew()
return self.client.list_conferences_by_organizer(lang=lang, limit=limit, organizer_id=organizer_id, since=since, status=status, extra_headers={'X-Octav-Session-ID': self.sid})
def list_external_resource (self, conference_id, lang=None, limit=None, since=None, extra_headers=None):
self.renew()
return self.client.list_external_resource(conference_id, lang=lang, limit=limit, since=since, extra_headers={'X-Octav-Session-ID': self.sid})
def list_featured_speakers (self, conference_id=None, lang=None, limit=None, since=None, extra_headers=None):
self.renew()
return self.client.list_featured_speakers(conference_id=conference_id, lang=lang, limit=limit, since=since, extra_headers={'X-Octav-Session-ID': self.sid})
def list_question (self, session_id, limit=None, since=None, extra_headers=None):
self.renew()
return self.client.list_question(session_id, limit=limit, since=since, extra_headers={'X-Octav-Session-ID': self.sid})
def list_room (self, venue_id, lang=None, limit=None, extra_headers=None):
self.renew()
return self.client.list_room(venue_id, lang=lang, limit=limit, extra_headers={'X-Octav-Session-ID': self.sid})
def list_session_types_by_conference (self, conference_id=None, lang=None, extra_headers=None):
self.renew()
return self.client.list_session_types_by_conference(conference_id=conference_id, lang=lang, extra_headers={'X-Octav-Session-ID': self.sid})
def list_sessions (self, conference_id=None, confirmed=None, lang=None, limit=None, range_end=None, range_start=None, since=None, speaker_id=None, status=None, extra_headers=None):
self.renew()
return self.client.list_sessions(conference_id=conference_id, confirmed=confirmed, lang=lang, limit=limit, range_end=range_end, range_start=range_start, since=since, speaker_id=speaker_id, status=status, extra_headers={'X-Octav-Session-ID': self.sid})
def list_sponsors (self, conference_id=None, lang=None, limit=None, since=None, extra_headers=None):
self.renew()
return self.client.list_sponsors(conference_id=conference_id, lang=lang, limit=limit, since=since, extra_headers={'X-Octav-Session-ID': self.sid})
def list_user (self, lang=None, limit=None, pattern=None, since=None, extra_headers=None):
self.renew()
return self.client.list_user(lang=lang, limit=limit, pattern=pattern, since=since, extra_headers={'X-Octav-Session-ID': self.sid})
def list_venue (self, lang=None, limit=None, since=None, extra_headers=None):
self.renew()
return self.client.list_venue(lang=lang, limit=limit, since=since, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_blog_entry (self, id, lang=None, extra_headers=None):
self.renew()
return self.client.lookup_blog_entry(id, lang=lang, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_conference (self, id, lang=None, extra_headers=None):
self.renew()
return self.client.lookup_conference(id, lang=lang, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_conference_by_slug (self, slug, lang=None, extra_headers=None):
self.renew()
return self.client.lookup_conference_by_slug(slug, lang=lang, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_conference_series (self, id, lang=None, extra_headers=None):
self.renew()
return self.client.lookup_conference_series(id, lang=lang, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_external_resource (self, id, lang=None, limit=None, since=None, extra_headers=None):
self.renew()
return self.client.lookup_external_resource(id, lang=lang, limit=limit, since=since, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_featured_speaker (self, id, lang=None, extra_headers=None):
self.renew()
return self.client.lookup_featured_speaker(id, lang=lang, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_room (self, id, extra_headers=None):
self.renew()
return self.client.lookup_room(id, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_session (self, id, lang=None, extra_headers=None):
self.renew()
return self.client.lookup_session(id, lang=lang, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_session_type (self, id, lang=None, extra_headers=None):
self.renew()
return self.client.lookup_session_type(id, lang=lang, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_sponsor (self, id, lang=None, extra_headers=None):
self.renew()
return self.client.lookup_sponsor(id, lang=lang, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_track (self, id, lang=None, extra_headers=None):
self.renew()
return self.client.lookup_track(id, lang=lang, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_user (self, id, sid=None, extra_headers=None):
self.renew()
return self.client.lookup_user(id, sid=sid, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_user_by_auth_user_id (self, auth_user_id, auth_via, extra_headers=None):
self.renew()
return self.client.lookup_user_by_auth_user_id(auth_user_id, auth_via, extra_headers={'X-Octav-Session-ID': self.sid})
def lookup_venue (self, id, lang=None, extra_headers=None):
self.renew()
return self.client.lookup_venue(id, lang=lang, extra_headers={'X-Octav-Session-ID': self.sid})
def send_all_selection_result_notification (self, conference_id, force=None, extra_headers=None):
self.renew()
return self.client.send_all_selection_result_notification(conference_id, force=force, extra_headers={'X-Octav-Session-ID': self.sid})
def send_selection_result_notification (self, id, force=None, session_id=None, extra_headers=None):
self.renew()
return self.client.send_selection_result_notification(id, force=force, session_id=session_id, extra_headers={'X-Octav-Session-ID': self.sid})
def set_session_video_cover (self, id, extra_headers=None):
self.renew()
return self.client.set_session_video_cover(id, extra_headers={'X-Octav-Session-ID': self.sid})
def tweet_as_conference (self, conference_id, tweet, extra_headers=None):
self.renew()
return self.client.tweet_as_conference(conference_id, tweet, extra_headers={'X-Octav-Session-ID': self.sid})
def update_blog_entry (self, id, status=None, title=None, url=None, extra_headers=None):
self.renew()
return self.client.update_blog_entry(id, status=status, title=title, url=url, extra_headers={'X-Octav-Session-ID': self.sid})
def update_conference (self, id, cfp_lead_text=None, cfp_post_submit_instructions=None, cfp_pre_submit_instructions=None, contact_information=None, description=None, redirect_url=None, slug=None, status=None, sub_title=None, timetable_available=None, timezone=None, title=None, extra_headers=None, **args):
self.renew()
return self.client.update_conference(id, cfp_lead_text=cfp_lead_text, cfp_post_submit_instructions=cfp_post_submit_instructions, cfp_pre_submit_instructions=cfp_pre_submit_instructions, contact_information=contact_information, description=description, redirect_url=redirect_url, slug=slug, status=status, sub_title=sub_title, timetable_available=timetable_available, timezone=timezone, title=title, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def update_external_resource (self, id, description=None, image_url=None, sort_order=None, title=None, url=None, extra_headers=None, **args):
self.renew()
return self.client.update_external_resource(id, description=description, image_url=image_url, sort_order=sort_order, title=title, url=url, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def update_featured_speaker (self, id, avatar_url=None, description=None, display_name=None, speaker_id=None, extra_headers=None, **args):
self.renew()
return self.client.update_featured_speaker(id, avatar_url=avatar_url, description=description, display_name=display_name, speaker_id=speaker_id, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def update_room (self, id, capacity=None, name=None, venue_id=None, extra_headers=None, **args):
self.renew()
return self.client.update_room(id, capacity=capacity, name=name, venue_id=venue_id, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def update_session (self, id, abstract=None, category=None, conference_id=None, confirmed=None, duration=None, has_interpretation=None, material_level=None, materials_release=None, memo=None, photo_release=None, recording_release=None, session_type_id=None, slide_language=None, slide_subtitles=None, slide_url=None, sort_order=None, speaker_id=None, spoken_language=None, starts_on=None, status=None, tags=None, title=None, video_url=None, extra_headers=None, **args):
self.renew()
return self.client.update_session(id, abstract=abstract, category=category, conference_id=conference_id, confirmed=confirmed, duration=duration, has_interpretation=has_interpretation, material_level=material_level, materials_release=materials_release, memo=memo, photo_release=photo_release, recording_release=recording_release, session_type_id=session_type_id, slide_language=slide_language, slide_subtitles=slide_subtitles, slide_url=slide_url, sort_order=sort_order, speaker_id=speaker_id, spoken_language=spoken_language, starts_on=starts_on, status=status, tags=tags, title=title, video_url=video_url, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def update_session_type (self, id, abstract=None, duration=None, is_default=None, name=None, submission_end=None, submission_start=None, extra_headers=None, **args):
self.renew()
return self.client.update_session_type(id, abstract=abstract, duration=duration, is_default=is_default, name=name, submission_end=submission_end, submission_start=submission_start, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def update_sponsor (self, id, group_name=None, logo_url=None, name=None, sort_order=None, url=None, extra_headers=None, **args):
self.renew()
return self.client.update_sponsor(id, group_name=group_name, logo_url=logo_url, name=name, sort_order=sort_order, url=url, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def update_track (self, id, name=None, room_id=None, sort_order=None, extra_headers=None, **args):
self.renew()
return self.client.update_track(id, name=name, room_id=room_id, sort_order=sort_order, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def update_user (self, id, email=None, first_name=None, lang=None, last_name=None, nickname=None, tshirt_size=None, extra_headers=None, **args):
self.renew()
return self.client.update_user(id, email=email, first_name=first_name, lang=lang, last_name=last_name, nickname=nickname, tshirt_size=tshirt_size, extra_headers={'X-Octav-Session-ID': self.sid}, **args)
def update_venue (self, id, latitude=None, longitude=None, name=None, place_id=None, url=None, extra_headers=None):
self.renew()
return self.client.update_venue(id, latitude=latitude, longitude=longitude, name=name, place_id=place_id, url=url, extra_headers={'X-Octav-Session-ID': self.sid})
def verify_user (self, id, extra_headers=None):
self.renew()
return self.client.verify_user(id, extra_headers={'X-Octav-Session-ID': self.sid})
class Octav(object):
def __init__(self, endpoint, key, secret, debug=False):
if not endpoint:
raise MissingRequiredArgument('endpoint is required')
if not key:
raise MissingRequiredArgument('key is required')
if not secret:
raise MissingRequiredArgument('secret is required')
self.debug = debug
self.endpoint = endpoint
self.error = None
self.http = PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where())
self.key = key
self.secret = secret
def new_session(self, access_token, auth_via):
if not access_token:
raise MissingRequiredArgument('access_token is required')
if not auth_via:
raise MissingRequiredArgument('auth_via is required')
f = functools.partial(self.create_client_session, access_token, auth_via)
s = f()
if s is None:
return None
return Session(self, f, s.get('sid'), parse_rfc3339(s.get('expires')))
def extract_error(self, r):
try:
js = json.loads(r.data)
if 'error' in js:
self.error = js['error']
elif 'message' in js:
self.error = js['message']
except BaseException:
self.error = r.status
def last_error(self):
return self.error
def last_response(self):
return self.res
def add_conference_admin (self, admin_id, conference_id, extra_headers=None):
try:
payload = {}
hdrs = {}
if admin_id is None:
raise MissingRequiredArgument('property admin_id must be provided')
payload['admin_id'] = admin_id
if conference_id is None:
raise MissingRequiredArgument('property conference_id must be provided')
payload['conference_id'] = conference_id
if admin_id is not None:
payload['admin_id'] = admin_id
if conference_id is not None:
payload['conference_id'] = conference_id
uri = '%s/v2/conference/admin/add' % self.endpoint
hdrs = urllib3.util.make_headers(
basic_auth='%s:%s' % (self.key, self.secret),
)
if self.debug:
print('POST %s' % uri)
hdrs['Content-Type']= 'application/json'
if extra_headers:
hdrs.update(extra_headers)
res = self.http.request('POST', uri, headers=hdrs, body=json.dumps(payload))
if self.debug:
print(res)
self.res = res
if res.status != 200:
self.extract_error(res)
return None
return True
except BaseException as e:
if self.debug:
print("error during http access: " + repr(e))
self.error = repr(e)
return None
def add_conference_credential (self, conference_id, data, type, extra_headers=None):
try:
payload = {}
hdrs = {}
if conference_id is None:
raise MissingRequiredArgument('property conference_id must be provided')
payload['conference_id'] = conference_id
if data is None:
raise MissingRequiredArgument('property data must be provided')
payload['data'] = data
if type is None:
raise MissingRequiredArgument('property type must be provided')
payload['type'] = type
if conference_id is not None:
payload['conference_id'] = conference_id
if data is not None:
payload['data'] = data
if type is not None:
payload['type'] = type
uri = '%s/v2/conference/credentials/add' % self.endpoint
hdrs = urllib3.util.make_headers(
basic_auth='%s:%s' % (self.key, self.secret),
)
if self.debug:
print('POST %s' % uri)
hdrs['Content-Type']= 'application/json'
if extra_headers:
hdrs.update(extra_headers)
res = self.http.request('POST', uri, headers=hdrs, body=json.dumps(payload))
if self.debug:
print(res)
self.res = res
if res.status != 200:
self.extract_error(res)
return None
return True
except BaseException as e:
if self.debug:
print("error during http access: " + repr(e))
self.error = repr(e)
return None
def add_conference_date (self, conference_id, date, extra_headers=None):
try:
payload = {}
hdrs = {}
if conference_id is None:
raise MissingRequiredArgument('property conference_id must be provided')
payload['conference_id'] = conference_id
if date is None:
raise MissingRequiredArgument('property date must be provided')
payload['date'] = date
if conference_id is not None:
payload['conference_id'] = conference_id
if date is not None:
payload['date'] = date
uri = '%s/v2/conference/date/add' % self.endpoint
hdrs = urllib3.util.make_headers(
basic_auth='%s:%s' % (self.key, self.secret),
)
if self.debug:
print('POST %s' % uri)
hdrs['Content-Type']= 'application/json'
if extra_headers:
hdrs.update(extra_headers)
res = self.http.request('POST', uri, headers=hdrs, body=json.dumps(payload))
if self.debug:
print(res)
self.res = res
if res.status != 200:
self.extract_error(res)
return None
return json.loads(res.data)
except BaseException as e:
if self.debug:
print("error during http access: " + repr(e))
self.error = repr(e)
return None
def add_conference_series_admin (self, admin_id, series_id, extra_headers=None):
try:
payload = {}
hdrs = {}
if admin_id is None:
raise MissingRequiredArgument('property admin_id must be provided')
payload['admin_id'] = admin_id
if series_id is None:
raise MissingRequiredArgument('property series_id must be provided')
payload['series_id'] = series_id
if admin_id is not None:
payload['admin_id'] = admin_id
if series_id is not None:
payload['series_id'] = series_id
uri = '%s/v2/conference_series/admin/add' % self.endpoint
hdrs = urllib3.util.make_headers(
basic_auth='%s:%s' % (self.key, self.secret),
)
if self.debug:
print('POST %s' % uri)
hdrs['Content-Type']= 'application/json'
if extra_headers:
hdrs.update(extra_headers)
res = self.http.request('POST', uri, headers=hdrs, body=json.dumps(payload))
if self.debug:
print(res)
self.res = res
if res.status != 200:
self.extract_error(res)
return None
return True
except BaseException as e:
if self.debug:
print("error during http access: " + repr(e))
self.error = repr(e)
return None
def add_conference_staff (self, conference_id, staff_id, extra_headers=None):
try:
payload = {}
hdrs = {}
if conference_id is None:
raise MissingRequiredArgument('property conference_id must be provided')
payload['conference_id'] = conference_id
if staff_id is None:
raise MissingRequiredArgument('property staff_id must be provided')
payload['staff_id'] = staff_id
if conference_id is not None:
payload['conference_id'] = conference_id
if staff_id is not None:
payload['staff_id'] = staff_id
uri = '%s/v2/conference/staff/add' % self.endpoint
hdrs = urllib3.util.make_headers(
basic_auth='%s:%s' % (self.key, self.secret),
)
if self.debug:
print('POST %s' % uri)
hdrs['Content-Type']= 'application/json'
if extra_headers:
hdrs.update(extra_headers)
res = self.http.request('POST', uri, headers=hdrs, body=json.dumps(payload))
if self.debug:
print(res)
self.res = res
if res.status != 200:
self.extract_error(res)
return None
return True
except BaseException as e:
if self.debug:
print("error during http access: " + repr(e))
self.error = repr(e)
return None
def add_conference_venue (self, conference_id, venue_id, extra_headers=None):
try:
payload = {}
hdrs = {}
if conference_id is None:
raise MissingRequiredArgument('property conference_id must be provided')
payload['conference_id'] = conference_id
if venue_id is None:
raise MissingRequiredArgument('property venue_id must be provided')
payload['venue_id'] = venue_id
if conference_id is not None:
payload['conference_id'] = conference_id
if venue_id is not None:
payload['venue_id'] = venue_id
uri = '%s/v2/conference/venue/add' % self.endpoint
hdrs = urllib3.util.make_headers(
basic_auth='%s:%s' % (self.key, self.secret),
)
if self.debug:
print('POST %s' % uri)
hdrs['Content-Type']= 'application/json'
if extra_headers:
hdrs.update(extra_headers)
res = self.http.request('POST', uri, headers=hdrs, body=json.dumps(payload))
if self.debug:
print(res)
self.res = res
if res.status != 200:
self.extract_error(res)
return None
return True
except BaseException as e:
if self.debug:
print("error during http access: " + repr(e))
self.error = repr(e)
return None
def add_featured_speaker (self, conference_id, description, display_name, avatar_url=None, speaker_id=None, extra_headers=None, **args):
try:
payload = {}
hdrs = {}
if conference_id is None:
raise MissingRequiredArgument('property conference_id must be provided')
payload['conference_id'] = conference_id
if description is None:
raise MissingRequiredArgument('property description must be provided')
payload['description'] = description
if display_name is None:
raise MissingRequiredArgument('property display_name must be provided')
payload['display_name'] = display_name
if avatar_url is not None:
payload['avatar_url'] = avatar_url
if conference_id is not None:
payload['conference_id'] = conference_id
if description is not None:
payload['description'] = description
if display_name is not None:
payload['display_name'] = display_name
if speaker_id is not None:
payload['speaker_id'] = speaker_id
patterns = [re.compile('description#[a-z]+'), re.compile('display_name#[a-z]+')]
for key in args:
for p in patterns:
if p.match(key):
payload[key] = args[key]
uri = '%s/v2/featured_speaker/add' % self.endpoint
hdrs = urllib3.util.make_headers(
basic_auth='%s:%s' % (self.key, self.secret),
)
if self.debug:
print('POST %s' % uri)
hdrs['Content-Type']= 'application/json'
if extra_headers:
hdrs.update(extra_headers)
res = self.http.request('POST', uri, headers=hdrs, body=json.dumps(payload))
if self.debug:
print(res)
self.res = res
if res.status != 200:
self.extract_error(res)
return None
return json.loads(res.data)
except BaseException as e:
if self.debug:
print("error during http access: " + repr(e))
self.error = repr(e)
return None
def add_session_type (self, abstract, conference_id, duration, name, submission_end=None, submission_start=None, extra_headers=None, **args):
try:
payload = {}
hdrs = {}
if abstract is None:
raise MissingRequiredArgument('property abstract must be provided')
payload['abstract'] = abstract
if conference_id is None:
raise MissingRequiredArgument('property conference_id must be provided')
payload['conference_id'] = conference_id
if duration is None:
raise MissingRequiredArgument('property duration must be provided')
payload['duration'] = duration
if name is None:
raise MissingRequiredArgument('property name must be provided')
payload['name'] = name
if abstract is not None:
payload['abstract'] = abstract
if conference_id is not None:
payload['conference_id'] = conference_id
if duration is not None:
payload['duration'] = duration
if name is not None:
payload['name'] = name
if submission_end is not None:
payload['submission_end'] = submission_end
if submission_start is not None:
payload['submission_start'] = submission_start
patterns = [re.compile('abstract#[a-z]+'), re.compile('name#[a-z]+')]
for key in args:
for p in patterns:
if p.match(key):
payload[key] = args[key]
uri = '%s/v2/conference/session_type/add' % self.endpoint
hdrs = urllib3.util.make_headers(
basic_auth='%s:%s' % (self.key, self.secret),
)
if self.debug:
print('POST %s' % uri)
hdrs['Content-Type']= 'application/json'
if extra_headers:
hdrs.update(extra_headers)
res = self.http.request('POST', uri, headers=hdrs, body=json.dumps(payload))
if self.debug:
print(res)
self.res = res
if res.status != 200:
self.extract_error(res)
return None
return True
except BaseException as e:
if self.debug:
print("error during http access: " + repr(e))
self.error = repr(e)
return None
def add_sponsor (self, conference_id, group_name, name, url, logo_url=None, sort_order=None, extra_headers=None, **args):
try:
payload = {}
hdrs = {}
if conference_id is None:
raise MissingRequiredArgument('property conference_id must be provided')
payload['conference_id'] = conference_id
if group_name is None:
raise MissingRequiredArgument('property group_name must be provided')
payload['group_name'] = group_name
if name is None:
raise MissingRequiredArgument('property name must be provided')
payload['name'] = name
if url is None:
raise MissingRequiredArgument('property url must be provided')
payload['url'] = url
if conference_id is not None:
payload['conference_id'] = conference_id
if group_name is not None:
payload['group_name'] = group_name
if logo_url is not None:
payload['logo_url'] = logo_url
if name is not None:
payload['name'] = name
if sort_order is not None:
payload['sort_order'] = sort_order
if url is not None:
payload['url'] = url
patterns = [re.compile('name#[a-z]+')]
for key in args:
for p in patterns:
if p.match(key):
payload[key] = args[key]
uri = '%s/v2/sponsor/add' % self.endpoint
hdrs = urllib3.util.make_headers(
basic_auth='%s:%s' % (self.key, self.secret),
)
if self.debug:
print('POST %s' % uri)
hdrs['Content-Type']= 'application/json'
if extra_headers:
hdrs.update(extra_headers)
res = self.http.request('POST', uri, headers=hdrs, body=json.dumps(payload))
if self.debug:
print(res)
self.res = res
if res.status != 200:
self.extract_error(res)
return None
return json.loads(res.data)
except BaseException as e:
if self.debug:
print("error during http access: " + repr(e))
self.error = repr(e)
return None
def confirm_temporary_email (self, confirmation_key, target_id, extra_headers=None):
try:
payload = {}
hdrs = {}
if confirmation_key is None:
raise MissingRequiredArgument('property confirmation_key must be provided')
payload['confirmation_key'] = confirmation_key
if target_id is None:
raise MissingRequiredArgument('property target_id must be provided')
payload['target_id'] = target_id
if confirmation_key is not None:
payload['confirmation_key'] = confirmation_key
if target_id is not None:
payload['target_id'] = target_id
uri = '%s/v2/email/confirm' % self.endpoint
hdrs = urllib3.util.make_headers(
basic_auth='%s:%s' % (self.key, self.secret),
)
if self.debug:
print('POST %s' % uri)
hdrs['Content-Type']= 'application/json'
if extra_headers:
hdrs.update(extra_headers)
res = self.http.request('POST', uri, headers=hdrs, body=json.dumps(payload))
if self.debug:
print(res)
self.res = res
if res.status != 200:
self.extract_error(res)
return None
return True
except BaseException as e:
if self.debug:
print("error during http access: " + repr(e))
self.error = repr(e)
return None
def create_blog_entry (self, conference_id, url, status=None, title=None, extra_headers=None):
try:
payload = {}
hdrs = {}
if conference_id is None:
raise MissingRequiredArgument('property conference_id must be provided')
payload['conference_id'] = conference_id
if url is None:
raise MissingRequiredArgument('property url must be provided')
payload['url'] = url
if conference_id is not None:
payload['conference_id'] = conference_id
if status is not None:
payload['status'] = status
if title is not None:
payload['title'] = title
if url is not None:
payload['url'] = url
uri = '%s/v2/blog_entry/create' % self.endpoint
hdrs = urllib3.util.make_headers(
basic_auth='%s:%s' % (self.key, self.secret),
)
if self.debug:
print('POST %s' % uri)
hdrs['Content-Type']= 'application/json'
if extra_headers:
hdrs.update(extra_headers)
res = self.http.request('POST', uri, headers=hdrs, body=json.dumps(payload))
if self.debug:
print(res)
self.res = res
if res.status != 200:
self.extract_error(res)
return None
return json.loads(res.data)
except BaseException as e:
if self.debug:
print("error during http access: " + repr(e))
self.error = repr(e)
return None
def create_client_session (self, access_token, auth_via, extra_headers=None):
try:
payload = {}
hdrs = {}
if access_token is None:
raise MissingRequiredArgument('property access_token must be provided')
payload['access_token'] = access_token
if auth_via is None:
raise MissingRequiredArgument('property auth_via must be provided')
payload['auth_via'] = auth_via
if access_token is not None:
payload['access_token'] = access_token
if auth_via is not None:
payload['auth_via'] = auth_via
uri = '%s/v2/client/session' % self.endpoint
hdrs = urllib3.util.make_headers(
basic_auth='%s:%s' % (self.key, self.secret),
)
if self.debug:
print('POST %s' % uri)
hdrs['Content-Type']= 'application/json'
if extra_headers:
hdrs.update(extra_headers)
res = self.http.request('POST', uri, headers=hdrs, body=json.dumps(payload))
if self.debug:
print(res)
self.res = res
if res.status != 200:
self.extract_error(res)
return None
return json.loads(res.data)
except BaseException as e:
if self.debug:
print("error during http access: " + repr(e))
self.error = repr(e)
return None
def create_conference (self, series_id, slug, title, cfp_lead_text=None, cfp_post_submit_instructions=None, cfp_pre_submit_instructions=None, contact_information=None, description=None, sub_title=None, timezone=None, extra_headers=None, **args):
try:
payload = {}
hdrs = {}
if series_id is None:
raise MissingRequiredArgument('property series_id must be provided')
payload['series_id'] = series_id
if slug is None:
raise MissingRequiredArgument('property slug must be provided')
payload['slug'] = slug
if title is None:
raise MissingRequiredArgument('property title must be provided')
payload['title'] = title
if cfp_lead_text is not None:
payload['cfp_lead_text'] = cfp_lead_text
if cfp_post_submit_instructions is not None:
payload['cfp_post_submit_instructions'] = cfp_post_submit_instructions
if cfp_pre_submit_instructions is not None:
payload['cfp_pre_submit_instructions'] = cfp_pre_submit_instructions
if contact_information is not None:
payload['contact_information'] = contact_information
if description is not None:
payload['description'] = description
if series_id is not None:
payload['series_id'] = series_id
if slug is not None: