removed trailing spaces
This commit is contained in:
@ -4,7 +4,7 @@ import json
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from .authmixin import AuthMixin, AuthError, HEADER_JSON
|
||||
|
||||
|
||||
def authenticated(func):
|
||||
@functools.wraps(func)
|
||||
def authenticated_call(*args, **kwargs):
|
||||
@ -43,12 +43,12 @@ class HttpClient(AuthMixin):
|
||||
response = requests.get(url, params=params, headers=headers, timeout=timeout, verify=self._verify_certificate)
|
||||
if response.ok:
|
||||
return response.json()
|
||||
else:
|
||||
else:
|
||||
if response.reason == "Unauthorized":
|
||||
self.config.delete()
|
||||
raise response.raise_for_status()
|
||||
|
||||
|
||||
|
||||
@authenticated
|
||||
def post_request(self, url, payload=None, headers=None, timeout=10):
|
||||
response = requests.post(url, json=payload, headers=headers, timeout=timeout, verify=self._verify_certificate).json()
|
||||
|
@ -1,5 +1,6 @@
|
||||
import functools
|
||||
from typing import Type, get_type_hints, TypeVar
|
||||
import functools
|
||||
|
||||
|
||||
def typechecked(func):
|
||||
@functools.wraps(func)
|
||||
@ -11,6 +12,7 @@ def typechecked(func):
|
||||
return func(*args, **kwargs)
|
||||
return typechecked_call
|
||||
|
||||
|
||||
def property_maker(cls, name, type_name):
|
||||
storage_name = '_' + name
|
||||
|
||||
@ -25,11 +27,14 @@ def property_maker(cls, name, type_name):
|
||||
|
||||
return prop
|
||||
|
||||
class Snippet(dict):
|
||||
|
||||
|
||||
class Snippet:
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self._properties = []
|
||||
self.set_properties(**kwargs)
|
||||
|
||||
|
||||
def set_properties(self, **kwargs):
|
||||
for key, value in kwargs.items():
|
||||
storage_name = '_' + key
|
||||
@ -64,19 +69,20 @@ class Snippet(dict):
|
||||
return cls.from_dict(response)
|
||||
|
||||
|
||||
|
||||
class Basesnippet(Snippet):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.set_properties(
|
||||
id=str,
|
||||
parentId=str,
|
||||
ownerGroup=str,
|
||||
accessGroups=list,
|
||||
snippetType=str,
|
||||
isPrivate=bool,
|
||||
createdAt=str,
|
||||
createdBy=str,
|
||||
updatedAt=str,
|
||||
id=str,
|
||||
parentId=str,
|
||||
ownerGroup=str,
|
||||
accessGroups=list,
|
||||
snippetType=str,
|
||||
isPrivate=bool,
|
||||
createdAt=str,
|
||||
createdBy=str,
|
||||
updatedAt=str,
|
||||
updateBy=str,
|
||||
subsnippets=list,
|
||||
tags=list,
|
||||
@ -88,7 +94,7 @@ class Basesnippet(Snippet):
|
||||
versionable=bool,
|
||||
deleted=bool)
|
||||
self.snippetType = "basesnippet"
|
||||
|
||||
|
||||
|
||||
|
||||
class Paragraph(Basesnippet):
|
||||
@ -98,7 +104,11 @@ class Paragraph(Basesnippet):
|
||||
self.snippetType = "paragraph"
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
tmp = Snippet(id=str, textcontent=str, defaultOrder=int)
|
||||
print(tmp.id)
|
||||
tmp.id = 2
|
||||
tmp.id = 2
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user