|
| 1 | +from __future__ import absolute_import |
| 2 | +import future.standard_library |
| 3 | +future.standard_library.install_aliases() |
| 4 | + |
1 | 5 | __author__ = "Robert Cope" |
2 | 6 |
|
3 | 7 | import sys |
4 | 8 | import requests |
5 | 9 | from requests.auth import HTTPBasicAuth |
6 | | -from urlparse import urljoin |
| 10 | +from urllib.parse import urljoin |
| 11 | + |
7 | 12 | import logging |
8 | 13 | try: |
9 | 14 | import anyjson as json |
@@ -31,7 +36,7 @@ def all_of(api_call, *args, **kwargs): |
31 | 36 | :param kwargs: Keyword arguments of the call. |
32 | 37 | """ |
33 | 38 | kwargs = kwargs.copy() |
34 | | - pos, outer_limit = 0, kwargs.get('limit', 0) or sys.maxint |
| 39 | + pos, outer_limit = 0, kwargs.get('limit', 0) or sys.maxsize |
35 | 40 | while True: |
36 | 41 | response = api_call(*args, **kwargs) |
37 | 42 | for item in response.get('results', []): |
@@ -805,9 +810,9 @@ def create_new_attachment_by_content_id(self, content_id, attachments, callback= |
805 | 810 | or the results of the callback. Will raise requests.HTTPError on bad input, potentially. |
806 | 811 | """ |
807 | 812 | if isinstance(attachments, list): |
808 | | - assert all(isinstance(at, dict) and "file" in at.keys() for at in attachments) |
| 813 | + assert all(isinstance(at, dict) and "file" in list(at.keys()) for at in attachments) |
809 | 814 | elif isinstance(attachments, dict): |
810 | | - assert "file" in attachments.keys() |
| 815 | + assert "file" in list(attachments.keys()) |
811 | 816 | else: |
812 | 817 | assert False |
813 | 818 | return self._service_post_request("rest/api/content/{id}/child/attachment".format(id=content_id), |
@@ -1034,7 +1039,7 @@ def update_attachment(self, content_id, attachment_id, attachment, callback=None |
1034 | 1039 | or the results of the callback. Will raise requests.HTTPError on bad input, potentially. |
1035 | 1040 | """ |
1036 | 1041 | if isinstance(attachment, dict): |
1037 | | - assert "file" in attachment.keys() |
| 1042 | + assert "file" in list(attachment.keys()) |
1038 | 1043 | else: |
1039 | 1044 | assert False |
1040 | 1045 | return self._service_post_request("rest/api/content/{content_id}/child/attachment/{attachment_id}/data" |
|
0 commit comments