Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,4 @@ src/Settings/servercreds.json
dist/
*.egg-info

.vscode
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Aspose Pty Ltd
Copyright (c) 2019 Aspose Pty Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
47 changes: 45 additions & 2 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Aspose.PDF Cloud API Reference


Copyright (c) 2018 Aspose.PDF Cloud
Copyright (c) 2019 Aspose.PDF Cloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Expand Down
21 changes: 20 additions & 1 deletion asposepdfcloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Aspose.PDF Cloud API Reference


Copyright (c) 2018 Aspose.PDF Cloud
Copyright (c) 2019 Aspose.PDF Cloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Expand Down Expand Up @@ -51,6 +51,7 @@
from .models.field_type import FieldType
from .models.file import File
from .models.file_exist import FileExist
from .models.file_icon import FileIcon
from .models.font_encoding_rules import FontEncodingRules
from .models.font_saving_modes import FontSavingModes
from .models.font_styles import FontStyles
Expand Down Expand Up @@ -86,6 +87,8 @@
from .models.shape_type import ShapeType
from .models.signature import Signature
from .models.signature_type import SignatureType
from .models.sound_encoding import SoundEncoding
from .models.sound_icon import SoundIcon
from .models.split_result import SplitResult
from .models.stamp import Stamp
from .models.stamp_type import StampType
Expand Down Expand Up @@ -127,6 +130,9 @@
from .models.field_response import FieldResponse
from .models.fields import Fields
from .models.fields_response import FieldsResponse
from .models.file_attachment_annotation_response import FileAttachmentAnnotationResponse
from .models.file_attachment_annotations import FileAttachmentAnnotations
from .models.file_attachment_annotations_response import FileAttachmentAnnotationsResponse
from .models.file_exist_response import FileExistResponse
from .models.file_version import FileVersion
from .models.file_versions_response import FileVersionsResponse
Expand All @@ -151,6 +157,9 @@
from .models.link_annotation_response import LinkAnnotationResponse
from .models.link_annotations import LinkAnnotations
from .models.link_annotations_response import LinkAnnotationsResponse
from .models.movie_annotation_response import MovieAnnotationResponse
from .models.movie_annotations import MovieAnnotations
from .models.movie_annotations_response import MovieAnnotationsResponse
from .models.page import Page
from .models.pages import Pages
from .models.poly_line_annotation_response import PolyLineAnnotationResponse
Expand All @@ -162,7 +171,13 @@
from .models.popup_annotation_response import PopupAnnotationResponse
from .models.popup_annotations import PopupAnnotations
from .models.popup_annotations_response import PopupAnnotationsResponse
from .models.redaction_annotation_response import RedactionAnnotationResponse
from .models.redaction_annotations import RedactionAnnotations
from .models.redaction_annotations_response import RedactionAnnotationsResponse
from .models.signature_verify_response import SignatureVerifyResponse
from .models.sound_annotation_response import SoundAnnotationResponse
from .models.sound_annotations import SoundAnnotations
from .models.sound_annotations_response import SoundAnnotationsResponse
from .models.split_result_document import SplitResultDocument
from .models.split_result_response import SplitResultResponse
from .models.square_annotation_response import SquareAnnotationResponse
Expand All @@ -186,15 +201,19 @@
from .models.word_count_response import WordCountResponse
from .models.annotation_info import AnnotationInfo
from .models.markup_annotation import MarkupAnnotation
from .models.movie_annotation import MovieAnnotation
from .models.popup_annotation import PopupAnnotation
from .models.redaction_annotation import RedactionAnnotation
from .models.caret_annotation import CaretAnnotation
from .models.common_figure_annotation import CommonFigureAnnotation
from .models.file_attachment_annotation import FileAttachmentAnnotation
from .models.free_text_annotation import FreeTextAnnotation
from .models.highlight_annotation import HighlightAnnotation
from .models.ink_annotation import InkAnnotation
from .models.line_annotation import LineAnnotation
from .models.poly_annotation import PolyAnnotation
from .models.popup_annotation_with_parent import PopupAnnotationWithParent
from .models.sound_annotation import SoundAnnotation
from .models.squiggly_annotation import SquigglyAnnotation
from .models.strike_out_annotation import StrikeOutAnnotation
from .models.text_annotation import TextAnnotation
Expand Down
39 changes: 4 additions & 35 deletions asposepdfcloud/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Aspose.PDF Cloud API Reference


Copyright (c) 2018 Aspose.PDF Cloud
Copyright (c) 2019 Aspose.PDF Cloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Expand Down Expand Up @@ -166,10 +166,6 @@ def __call_api(self, resource_path, method,
guess_type(filename)[0] or 'application/octet-stream'
header_params['Content-Type'] = mimetype


# auth setting
self.update_params_for_auth(header_params, query_params, auth_settings)

# body
if body:
body = self.sanitize_for_serialization(body)
Expand Down Expand Up @@ -611,33 +607,6 @@ def select_header_content_type(self, content_types):
else:
return content_types[0]

def update_params_for_auth(self, headers, querys, auth_settings):
"""
Updates header and query params based on authentication setting.

:param headers: Header parameters dict to be updated.
:param querys: Query parameters tuple list to be updated.
:param auth_settings: Authentication setting identifiers list.
"""
config = Configuration()

if not auth_settings:
return

for auth in auth_settings:
auth_setting = config.auth_settings().get(auth)
if auth_setting:
if not auth_setting['value']:
continue
elif auth_setting['in'] == 'header':
headers[auth_setting['key']] = auth_setting['value']
elif auth_setting['in'] == 'query':
querys.append((auth_setting['key'], auth_setting['value']))
else:
raise ValueError(
'Authentication token must be in `query` or `header`'
)

def __deserialize_file(self, response):
"""
Saves response body into a file in a temporary folder,
Expand All @@ -653,7 +622,7 @@ def __deserialize_file(self, response):
os.remove(path)

content_disposition = response.getheader("Content-Disposition")
if content_disposition:
if content_disposition and content_disposition != "attachment":
filename = re.\
search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition).\
group(1)
Expand Down Expand Up @@ -713,9 +682,9 @@ def __deserialize_date(self, string):
)

def __deserialize_datatime(self, string):
match = re.match(r"\/Date\((\d+?)000\+0000\)\/", string)
match = re.match(r'/Date\((\d+?)000\+0000\)/', string, flags=re.UNICODE)
if match:
dt = datetime.utcfromtimestamp(int(match[1]))
dt = datetime.utcfromtimestamp(int(match.group(1)))
return dt
else:
return None
Expand Down
2 changes: 1 addition & 1 deletion asposepdfcloud/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Aspose.PDF Cloud API Reference


Copyright (c) 2018 Aspose.PDF Cloud
Copyright (c) 2019 Aspose.PDF Cloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Expand Down
Loading