forgot to add sql/table.py
This commit is contained in:
parent
1206aaab74
commit
c0c489b719
|
@ -358,6 +358,36 @@ class PropertyValue(DotDict):
|
|||
|
||||
|
||||
class Nodeinfo(DotDict):
|
||||
@property
|
||||
def name(self):
|
||||
return self.software.name
|
||||
|
||||
|
||||
@property
|
||||
def version(self):
|
||||
return self.software.version
|
||||
|
||||
|
||||
@property
|
||||
def repo(self):
|
||||
return self.software.repository
|
||||
|
||||
|
||||
@property
|
||||
def homepage(self):
|
||||
return self.software.homepage
|
||||
|
||||
|
||||
@property
|
||||
def users(self):
|
||||
return self.usage.users.total
|
||||
|
||||
|
||||
@property
|
||||
def posts(self):
|
||||
return self.usage.localPosts
|
||||
|
||||
|
||||
@classmethod
|
||||
def new_20(cls, name, version, **metadata):
|
||||
return cls.new(name, version, '2.0', **metadata)
|
||||
|
@ -427,6 +457,14 @@ class Nodeinfo(DotDict):
|
|||
|
||||
|
||||
class WellknownNodeinfo(DotDict):
|
||||
def url(self, version='2.1'):
|
||||
assert version in ['2.0', '2.1']
|
||||
|
||||
for link in self.links:
|
||||
if link['rel'].endswith(version):
|
||||
return link['href']
|
||||
|
||||
|
||||
@classmethod
|
||||
def new(cls, path, version='2.1'):
|
||||
data = cls(links=[])
|
||||
|
|
|
@ -115,7 +115,7 @@ class HttpUrllibClient:
|
|||
fd.write(byte.getvalue())
|
||||
|
||||
|
||||
def json(self, *args, headers={}, activity=True, **kwargs):
|
||||
def json(self, *args, headers={}, activity=False, **kwargs):
|
||||
json_type = 'activity+json' if activity else 'json'
|
||||
headers.update({
|
||||
'accept': f'application/{json_type}'
|
||||
|
|
Loading…
Reference in a new issue