forked from sigmavirus24/github3.py
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgithub.py
More file actions
829 lines (719 loc) · 28 KB
/
Copy pathgithub.py
File metadata and controls
829 lines (719 loc) · 28 KB
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
"""
github3.github
==============
This module contains the main GitHub session object.
"""
from requests import session
from json import dumps
from .event import Event
from .gist import Gist
from .issue import Issue, issue_params
from .legacy import LegacyIssue, LegacyRepo, LegacyUser
from .models import GitHubCore
from .org import Organization
from .repo import Repository
from .user import User, Key
class GitHub(GitHubCore):
"""Stores all the session information."""
def __init__(self, login='', password=''):
super(GitHub, self).__init__({})
# Only accept JSON responses
self._session.headers.update(
{'Accept': 'application/vnd.github.full+json'})
# Only accept UTF-8 encoded data
self._session.headers.update({'Accept-Charset': 'utf-8'})
# Identify who we are
self._session.config['base_headers'].update(
{'User-Agent': 'github3.py/pre-alpha'})
if login and password:
self.login(login, password)
def __repr__(self):
return '<GitHub at 0x{0:x}>'.format(id(self))
def _list_follow(self, which):
url = self._build_url('user', which)
resp = self._get(url)
json = self._json(resp, 200)
return [User(f, self) for f in json]
def authorization(self, id_num):
"""Get information about authorization ``id``.
:param id_num: (required), unique id of the authorization
:type id_num: int
:returns: :class:`Authorization <Authorization>`
"""
json = None
if int(id_num) > 0:
url = self._github_url('authorizations', str(id_num))
json = self._json(self._get(url), 200)
return Authorization(json, self) if json else None
def authorize(self, login, password, scopes, note='', note_url=''):
"""Obtain an authorization token from the GitHub API for the GitHub
API.
:param login: (required)
:type login: str
:param password: (required)
:type password: str
:param scopes: (required), areas you want this token to apply to,
i.e., 'gist', 'user'
:type scopes: list of strings
:param note: (optional), note about the authorization
:returns: :class:`Authorization <Authorization>`
"""
json = None
auth = self._session.auth or (login and password)
if isinstance(scopes, list) and scopes and auth:
url = self._build_url('authorizations')
data = dumps({'scopes': scopes, 'note': note,
'note_url': note_url})
if self._session.auth:
json = self._json(self._post(url, data=data), 201)
else:
ses = session()
ses.auth = (login, password)
json = self._json(ses.post(url, data=data), 201)
return Authorization(json, self) if json else None
def create_gist(self, description, files, public=True):
"""Create a new gist.
If no login was provided, it will be anonymous.
:param description: (required), description of gist
:type description: str
:param files: (required), file names with associated dictionaries for
content, e.g. ``{'spam.txt': {'content': 'File contents ...'}}``
:type files: dict
:param public: (optional), make the gist public if True
:type public: bool
:returns: :class:`Gist <github3.gist.Gist>`
"""
new_gist = {'description': description, 'public': public,
'files': files}
url = self._build_url('gists')
json = self._json(self._post(url, dumps(new_gist)), 201)
return Gist(json, self) if json else None
def create_issue(self,
owner,
repository,
title,
body=None,
assignee=None,
milestone=None,
labels=[]):
"""Create an issue on the project 'repository' owned by 'owner'
with title 'title'.
body, assignee, milestone, labels are all optional.
:param owner: (required), login of the owner
:type owner: str
:param repository: (required), repository name
:type repository: str
:param title: (required), Title of issue to be created
:type title: str
:param body: (optional), The text of the issue, markdown
formatted
:type body: str
:param assignee: (optional), Login of person to assign
the issue to
:type assignee: str
:param milestone: (optional), Which milestone to assign
the issue to
:type milestone: str
:param labels: (optional), List of label names.
:type labels: list
:returns: :class:`Issue <github3.issue.Issue>`
"""
repo = None
if owner and repository and title:
repo = self.repository(owner, repository)
if repo:
return repo.create_issue(title, body, assignee, milestone, labels)
# Regardless, something went wrong. We were unable to create the
# issue
return None
def create_key(self, title, key):
"""Create a new key for the authenticated user.
:param title: (required), key title
:type title: str
:param key: (required), actual key contents
:type key: str or file
:returns: :class:`Key <github3.user.Key>`
"""
created = None
if title and key:
url = self._build_url('user', 'keys')
req = self._post(url, dumps({'title': title, 'key': key}))
json = self._json(req, 201)
if json:
created = Key(json, self)
return created
def create_repo(self,
name,
description='',
homepage='',
private=False,
has_issues=True,
has_wiki=True,
has_downloads=True):
"""Create a repository for the authenticated user.
:param name: (required), name of the repository
:type name: str
:param description: (optional)
:type description: str
:param homepage: (optional)
:type homepage: str
:param private: (optional), If ``True``, create a
private repository. API default: ``False``
:type private: bool
:param has_issues: (optional), If ``True``, enable
issues for this repository. API default: ``True``
:type has_issues: bool
:param has_wiki: (optional), If ``True``, enable the
wiki for this repository. API default: ``True``
:type has_wiki: bool
:param has_downloads: (optional), If ``True``, enable
downloads for this repository. API default: ``True``
:type has_downloads: bool
:returns: :class:`Repository <github3.repo.Repository>`
"""
url = self._build_url('user', 'repos')
data = dumps({'name': name, 'description': description,
'homepage': homepage, 'private': private,
'has_issues': has_issues, 'has_wiki': has_wiki,
'has_downloads': has_downloads})
json = self._json(self._post(url, data), 201)
return Repository(json, self) if json else None
def delete_key(self, key_id):
"""Delete user key pointed to by ``key_id``.
:param key_id: (required), unique id used by Github
:type: int
:returns: bool
"""
key = self.get_key(key_id)
if key:
return key.delete()
return False
def follow(self, login):
"""Make the authenticated user follow login.
:param login: (required), user to follow
:type login: str
:returns: bool
"""
resp = False
if login:
url = self._build_url('user', 'following', login)
resp = self._boolean(self._put(url), 204, 404)
return resp
def get_key(self, id_num):
"""Gets the authenticated user's key specified by id_num.
:param id_num: (required), unique id of the key
:type id_num: int
:returns: :class:`Key <github3.user.Key>`
"""
json = None
if int(id_num) > 0:
url = self._build_url('user', 'keys', str(id_num))
json = self.json(self._get(url), 200)
return Key(json, self) if json else None
def gist(self, id_num):
"""Gets the gist using the specified id number.
:param id_num: (required), unique id of the gist
:type id_num: int
:returns: :class:`Gist <github3.gist.Gist>`
"""
url = self._build_url('gists', str(id_num))
json = self._json(self._get(url), 200)
return Gist(json, self) if json else None
def is_following(self, login):
"""Check if the authenticated user is following login.
:param login: (required), login of the user to check if the
authenticated user is checking
:type login: str
:returns: bool
"""
json = False
if login:
url = self._build_url('user', 'following', login)
json = self._boolean(self._get(url), 204, 404)
return json
def is_watching(self, login, repo):
"""Check if the authenticated user is following login/repo.
:param login: (required), owner of repository
:type login: str
:param repo: (required), name of repository
:type repo: str
:returns: bool
"""
json = False
if login and repo:
url = self._build_url('user', 'watched', login, repo)
json = self._boolean(self._get(url), 204, 404)
return json
def issue(self, owner, repository, number):
"""Fetch issue #:number: from https://github.com/:owner:/:repository:
:param owner: (required), owner of the repository
:type owner: str
:param repository: (required), name of the repository
:type repository: str
:param number: (required), issue number
:type number: int
:return: :class:`Issue <github3.issue.Issue>`
"""
repo = self.repository(owner, repository)
if repo:
return repo.issue(number)
return None
def list_authorizations(self):
"""List authorizations for the authenticated user.
:returns: list of :class:`Authorization <Authorization>`\ s
"""
url = self._build_url('authorizations')
json = self._json(self._get(url), 200)
return [Authorization(a, self) for a in json]
def list_emails(self):
"""List email addresses for the authenticated user.
:returns: list of dicts
"""
url = self._build_url('user', 'emails')
req = self._get(url)
return self._json(req, 200) or []
def list_events(self):
"""List public events.
:returns: list of :class:`Event <github3.event.Event>`\ s
"""
url = self._build_url('events')
json = self._json(self._get(url), 200)
return [Event(ev, self) for ev in json]
def list_followers(self, login=None):
"""If login is provided, return a list of followers of that
login name; otherwise return a list of followers of the
authenticated user.
:param login: (optional), login of the user to check
:type login: str
:returns: list of :class:`User <github3.user.User>`\ s
"""
if login:
return self.user(login).list_followers()
return self._list_follow('followers')
def list_following(self, login=None):
"""If login is provided, return a list of users being followed
by login; otherwise return a list of people followed by the
authenticated user.
:param login: (optional), login of the user to check
:type login: str
:returns: list of :class:`User <github3.user.User>`\ s
"""
if login:
return self.user(login).list_following()
return self._list_follow('following')
def list_gists(self, username=None):
"""If no username is specified, GET /gists, otherwise GET
/users/:username/gists
:param login: (optional), login of the user to check
:type login: str
:returns: list of :class:`Gist <github3.gist.Gist>`\ s
"""
if username:
url = self._build_url('users', username, 'gists')
else:
url = self._build_url('gists')
json = self._json(self._get(url), 200)
return [Gist(gist, self) for gist in json]
def list_issues(self,
owner='',
repository='',
filter='',
state='',
labels='',
sort='',
direction='',
since=''):
"""If no parameters are provided, this gets the issues for the
authenticated user. All parameters are optional with the
exception that owner and repository must be supplied together.
:param filter: accepted values:
('assigned', 'created', 'mentioned', 'subscribed')
api-default: 'assigned'
:type filter: str
:param state: accepted values: ('open', 'closed')
api-default: 'open'
:type state: str
:param labels: comma-separated list of label names, e.g.,
'bug,ui,@high'
:type labels: str
:param sort: accepted values: ('created', 'updated', 'comments')
api-default: created
:type sort: str
:param direction: accepted values: ('asc', 'desc')
api-default: desc
:type direction: str
:param since: ISO 8601 formatted timestamp, e.g.,
2012-05-20T23:10:27Z
:type since: str
:returns: list of :class:`Issue <github3.issue.Issue>`\ s
"""
if owner and repository:
repo = self.repository(owner, repository)
issues = repo.list_issues()
else:
url = self._build_url('issues')
params = issue_params(filter, state, labels, sort, direction,
since)
json = self._json(self._get(url, params=params), 200)
issues = [Issue(issue, self) for issue in json]
return issues
def list_keys(self):
"""List public keys for the authenticated user.
:returns: list of :class:`Key <github3.user.Key>`\ s
"""
url = self._build_url('user', 'keys')
json = self._json(self._get(url), 200)
return [Key(key, self) for key in json]
def list_orgs(self, login=None):
"""List public organizations for login if provided; otherwise
list public and private organizations for the authenticated
user.
:param login: (optional), user whose orgs you wish to list
:type login: str
:returns: list of :class:`Organization <github3.org.Organization>`\ s
"""
if login:
url = self._build_url('users', login, 'orgs')
else:
url = self._build_url('usr', 'orgs')
json = self._json(self._get(url), 200)
return [Organization(org, self) for org in json]
def list_repos(self, login=None, type='', sort='', direction=''):
"""List public repositories for the specified ``login`` or all
repositories for the authenticated user if ``login`` is not
provided.
:param login: (optional)
:type login: str
:param type: (optional), accepted values:
('all', 'owner', 'public', 'private', 'member')
API default: 'all'
:type type: str
:param sort: (optional), accepted values:
('created', 'updated', 'pushed', 'full_name')
API default: 'created'
:type sort: str
:param direction: (optional), accepted values:
('asc', 'desc'), API default: 'asc' when using 'full_name',
'desc' otherwise
:type direction: str
:returns: list of :class:`Repository <github3.repo.Repository>`
objects
"""
if login:
url = self._build_url('users', login, 'repos')
else:
url = self._build_url('user', 'repos')
params = {}
if type in ('all', 'owner', 'public', 'private', 'member'):
params.update(type=type)
if not login:
if sort in ('created', 'updated', 'pushed', 'full_name'):
params.update(sort=sort)
if direction in ('asc', 'desc'):
params.update(direction=direction)
json = self._json(self._get(url, params=params), 200)
return [Repository(repo, self) for repo in json]
def list_watching(self, login=None):
"""List the repositories being watched by ``login`` if provided or the
repositories being watched by the authenticated user.
:param login: (optional)
:type login: str
:returns: list of :class:`Repository <github3.repo.Repository>`
objects
"""
if login:
url = self._build_url('users', login, 'watched')
else:
url = self._build_url('user', 'watched')
json = self._json(self._get(url), 200)
return [Repository(repo, self) for repo in json]
def login(self, username=None, password=None, token=None):
"""Logs the user into GitHub for protected API calls.
:param username: (optional)
:type username: str
:param password: (optional)
:type password: str
:param token: (optional)
:type token: str
"""
if username and password:
self._session.auth = (username, password)
elif token:
self._session.headers.update({
'Authorization': 'token ' + token
})
def markdown(self, text, mode='', context='', raw=False):
"""Render an arbitrary markdown document.
:param text: (required), the text of the document to render
:type text: str
:param mode: (optional), 'markdown' or 'gfm'
:type mode: str
:param context: (optional), only important when using mode 'gfm',
this is the repository to use as the context for the rendering
:type context: str
:param raw: (optional), renders a document like a README.md, no gfm, no
context
:type raw: bool
:returns: str -- HTML formatted text
"""
data = None
headers = {}
if raw:
url = self._build_url('markdown', 'raw')
data = text
headers['content-type'] = 'text/plain'
else:
url = self._build_url('markdown')
data = {}
if text:
data['text'] = text
if mode in ('markdown', 'gfm'):
data['mode'] = mode
if context:
data['context'] = context
data = dumps(data)
if data:
req = self._post(url, data=data, headers=headers)
if req.ok:
return req.content
return ''
def organization(self, login):
"""Returns a Organization object for the login name
:param login: (required), login name of the org
:type login: str
:returns: :class:`Organization <github3.org.Organization>`
"""
url = self._build_url('orgs', login)
json = self._json(self._get(url), 200)
return Organization(json, self) if json else None
def repository(self, owner, repository):
"""Returns a Repository object for the specified combination of
owner and repository
:param owner: (required)
:type owner: str
:param repository: (required)
:type repository: str
:returns: :class:`Repository <github3.repo.Repository>`
"""
url = self._build_url('repos', owner, repository)
json = self._json(self._get(url), 200)
return Repository(json, self) if json else None
def search_issues(self, owner, repo, state, keyword):
"""Find issues by state and keyword.
:param owner: (required)
:type owner: str
:param repo: (required)
:type repo: str
:param state: (required), accepted values: ('open', 'closed')
:type state: str
:param keyword: (required), what to search for
:type keyword: str
:returns: list of :class:`LegacyIssue <github3.legacy.LegacyIssue>`\ s
"""
url = self._build_url('legacy', 'issues', 'search', owner, repo,
state, keyword)
json = self._json(self._get(url), 200)
issues = json.get('issues', [])
return [LegacyIssue(l, self) for l in issues]
def search_repos(self, keyword, **params):
"""Search all repositories by keyword.
:param keyword: (required)
:type keyword: str
:param params: (optional), filter by language and/or start_page
:type params: dict
:returns: list of :class:`LegacyRepo <github3.legacy.LegacyRepo>`\ s
"""
url = self._build_url('legacy', 'repos', 'search', keyword)
json = self._json(self._get(url, params=params), 200)
repos = json.get('repositories', [])
return [LegacyRepo(r, self) for r in repos]
def search_users(self, keyword):
"""Search all users by keyword.
:param keyword: (required)
:type keyword: str
:returns: list of :class:`LegacyUser <github3.legacy.LegacyUser>`\ s
"""
url = self._github_url + '/legacy/user/search/{0}'.format(keyword)
json = self._json(self._get(url), 200)
users = json.get('users', [])
return [LegacyUser(u, self) for u in users]
def search_email(self, email):
"""Search users by email.
:param email: (required)
:type keyword: str
:returns: :class:`LegacyUser <github3.legacy.LegacyUser>`
"""
url = self._build_url('legacy', 'user', 'email', email)
json = self._json(self._get(url), 200)
u = json.get('user', {})
return LegacyUser(u, self) if u else None
def unfollow(self, login):
"""Make the authenticated user stop following login
:param login: (required)
:type login: str
:returns: bool
"""
resp = False
if login:
url = self._build_url('user', 'following', login)
resp = self._boolean(self._delete(url), 204, 404)
return resp
def update_user(self, name=None, email=None, blog=None,
company=None, location=None, hireable=False, bio=None):
"""If authenticated as this user, update the information with
the information provided in the parameters. All parameters are
optional.
:param name: e.g., 'John Smith', not login name
:type name: str
:param email: e.g., '[email protected]'
:type email: str
:param blog: e.g., 'http://www.example.com/jsmith/blog'
:type blog: str
:param company: company name
:type company: str
:param location: where you are located
:type location: str
:param hireable: defaults to False
:type hireable: bool
:param bio: GitHub flavored markdown
:type bio: str
:returns: bool
"""
user = self.user()
if user:
return user.update(name, email, blog, company, location, hireable,
bio)
return False
def user(self, login=None):
"""Returns a User object for the specified login name if
provided. If no login name is provided, this will return a User
object for the authenticated user.
:param login: (optional)
:type login: str
:returns: :class:`User <github3.user.User>`
"""
if login:
url = self._build_url('users', login)
else:
url = self._build_url('user')
json = self._json(self._get(url), 200)
return User(json, self._session) if json else None
def watch(self, login, repo):
"""Make user start watching login/repo.
:param login: (required), owner of repository
:type login: str
:param repo: (required), name of repository
:type repo: str
:returns: bool
"""
resp = False
if login and repo:
url = self._build_url('user', 'watched', login, repo)
resp = self._boolean(self._put(url), 204, 404)
return resp
def unwatch(self, login, repo):
"""Make user stop watching login/repo.
:param login: (required), owner of repository
:type login: str
:param repo: (required), name of repository
:type repo: str
:returns: bool
"""
resp = False
if login and repo:
url = self._build_url('user', 'watched', login, repo)
resp = self._boolean(self._delete(url), 204, 404)
return resp
class Authorization(GitHubCore):
"""The :class:`Authorization <Authorization>` object."""
def __init__(self, auth, session):
super(Authorization, self).__init__(auth, session)
self._update_(auth)
def __repr__(self):
return '<Authorization [{0}]>'.format(self._app.get('name', ''))
def _update_(self, auth):
self._app = auth.get('app', {})
self._token = auth.get('token', '')
self._note_url = auth.get('note_url', '')
self._note = auth.get('note', '')
self._scopes = auth.get('scopes', [])
self._id = auth.get('id', 0)
self._api = self._build_url('authorizations', str(self._id))
self._created = None
if auth.get('created_at'):
self._created = self._strptime(auth.get('created_at'))
self._updated = None
if auth.get('updated_at'):
self._updated = self._strptime(auth.get('updated_at'))
@property
def app(self):
"""Details about the application"""
return self._app
@property
def created_at(self):
"""datetime object representing when the authorization was created."""
return self._created
def delete(self):
"""delete this authorization"""
return self._boolean(self._delete(self._api), 204, 404)
@property
def id(self):
"""Unique id of the authorization"""
return self._id
@property
def note(self):
"""Note about the authorization"""
return self._note
@property
def note_url(self):
"""URL about the note"""
return self._note_url
@property
def scopes(self):
"""List of scopes this applies to"""
return self._scopes
@property
def token(self):
"""Returns the Authorization token"""
return self._token
def update(self, scopes=[], add_scopes=[], rm_scopes=[], note='',
note_url=''):
"""Update this authorization.
:param scopes: (optional), replaces the authorization scopes with these
:type scopes: list
:param add_scopes: (optional), scopes to be added
:type add_scopes: list
:param rm_scopes: (optional), scopes to be removed
:type rm_scopes: list
:param note: (optional), new note about authorization
:type note: str
:param note_url: (optional), new note URL about this authorization
:type note_url: str
:returns: bool
"""
success = False
if scopes:
d = dumps({'scopes': scopes})
json = self._json(self._get(self._api, data=d), 200)
self._update_(json)
success = True
if add_scopes:
d = dumps({'add_scopes': add_scopes})
json = self._json(self._get(self._api, data=d), 200)
self._update_(json)
success = True
if rm_scopes:
d = dumps({'remove_scopes': rm_scopes})
json = self._json(self._get(self._api, data=d), 200)
self._update_(json)
success = True
if note or note_url:
d = dumps({'note': note, 'note_url': note_url})
json = self._json(self._get(self._api, data=d), 200)
self._update_(json)
success = True
return success
@property
def updated_at(self):
"""datetime object representing when the authorization was created."""
return self._updated