Commit Graph

91 Commits

Author SHA1 Message Date
a98986a261 Added pillarsdk.utils.is_valid_id(some_id) function.
This allows Pillar-Web to check for ID validity before sending IDs
from the URL to Pillar.
2016-06-29 13:05:04 +02:00
7b6a42f3e7 Bumped version to 1.3.0 2016-06-28 15:28:06 +02:00
cdb68fbcf7 Ensure Resource.find_first returns an object of the correct type. 2016-06-17 14:29:16 +02:00
9a256bf07d Also expose ForbiddenAccess exception 2016-06-17 14:29:03 +02:00
b8048925a1 Force projection of Project.category and Project.user.
This is required for finding the home project.
2016-06-15 15:12:11 +02:00
7b96aa656b Separated api.get() from utils.convert_datetime() call.
Both are equally likely to fail, so now we can see which from the stack
trace and the line number.
2016-05-31 17:58:13 +02:00
72499b6fbb Added Resource.new(dict_or_resource) class method.
This allows one to up-cast a Resource to a File, Project, Node, etc.
2016-05-31 17:57:40 +02:00
03fab52da2 Prevent KeyError when thumbnail has no link.
This can happen when the link isn't refreshing properly. It's better to
show an empty thumbnail than a 500 Internal Server Error.
2016-05-31 17:57:08 +02:00
4b028d85c9 Added exception for HTTP 412/Precondition Failed 2016-05-30 14:54:27 +02:00
b1c2b105af Expose Resource class at top module level 2016-05-23 18:12:22 +02:00
2d195c7cd3 Added User.me() and Find.find_from_endpoint() class methods. 2016-05-23 14:19:14 +02:00
75d71b824f Bumped version to 1.2.0 2016-05-18 15:26:17 +02:00
3e223bcc9f Added List.all_from_endpoint(url) function.
This is useful when resources should be loaded from a custom Pillar
endpoint.
2016-05-18 13:02:26 +02:00
cfa8840c64 Add URL in error messages. 2016-05-18 13:02:02 +02:00
8312388641 Removed File.thumbnail_file in favour of File.thumbnail 2016-05-13 10:51:26 +02:00
bea3385866 Bumped version to 1.1.2 2016-05-10 15:03:28 +02:00
99d46593bf made "'field' in resource" work 2016-05-10 15:02:27 +02:00
a9920fa76a Files: Get thumbnails from variations, rather than from 'link' property
The 'link' property might not exist, for example when a user is not a
Cloud subscriber.
2016-05-10 12:45:27 +02:00
56da7923d7 Bumped version to 1.1.1 2016-05-09 14:36:25 +02:00
a229251f62 Gracefully handle missing 'allowed_methods' 2016-05-09 14:34:25 +02:00
a6364f338e Bumped version to 1.1.0 2016-05-09 12:19:58 +02:00
2664c7bf8b Use new /p/create entry point for project creation
Instead of POSTing to /projects, we now use /p/create to create a new
project.
2016-05-09 11:17:46 +02:00
ef6ea3a927 Little tweak. 2016-05-06 10:49:35 +02:00
eb5ad24a32 User management functions for projects 2016-05-06 10:43:24 +02:00
3cad957a4d Bumped version to 1.0.1 2016-05-06 10:26:41 +02:00
6c51cc7321 Tokens: pass None password as '' 2016-05-06 10:18:58 +02:00
38de7d6433 Include subclient-ID in the password field when authenticating with token. 2016-05-04 14:08:46 +02:00
b74053a95b Support getting /latest node type entry point 2016-05-02 19:05:53 +02:00
e088b56560 Pop more _deleted attributes. 2016-05-02 17:43:06 +02:00
838fbd14ae Remove _deleted private key 2016-04-29 10:01:11 +02:00
d60a1878e7 Skip missing keys in convert_datetime 2016-04-26 17:33:36 +02:00
e6ef3c2332 Pass empty password when using token 2016-04-13 15:32:10 +02:00
463eb068f6 Ensuring more projections 2016-04-13 15:31:58 +02:00
9a51c82d9a Added util function for filename sanitation 2016-03-22 14:32:34 +01:00
dac5d638da Added support for saving Pillar resources as JSON. 2016-03-22 12:42:31 +01:00
2c39a88cfe Removed unused import 2016-03-22 12:42:13 +01:00
20a9c61fac Include link & link_expires in mandatory projections for File. 2016-03-22 12:41:41 +01:00
886e3c7eaf Sort parameters on the URL to allow caching.
Python randomizes dict item order with a random seed, which changes every
time Python/Blender is run. As a result, Pillar GET parameters on the URL
would change, making them uncachable. Sorting the parameters solves this.
2016-03-18 16:37:16 +01:00
1ec234716a Log to 'pillarsdk.api' logger, instead of the root logger.
Also switched to percent-formatting, as this allows the logging module
to skip string formatting altogether if the log entry is filtered out
(for example for INFO messages on a logger with level=WARNING).
2016-03-18 14:00:55 +01:00
c8cc82f96b Don't assume UTF-8, just use content encoding from HTTP headers. 2016-03-18 13:56:26 +01:00
2ef050dd8f Simplified code 2016-03-18 12:41:36 +01:00
0fd043ecb8 Support session objects.
This not only improves general performance by sharing socket connections
between HTTP calls, but also allows for caching with Requests-Cache.
2016-03-18 12:41:24 +01:00
914e8f9eaa Moved _ensure_projections(...) up from Find to Resource
It's now also used in List
2016-03-18 10:59:57 +01:00
bcde995e64 Tweak to Project update
Now we use utils.remove_none_attributes to remove None values, and
revert to file _id only if it exists.
2016-03-16 16:08:51 +01:00
42fd0aebd9 Added doc string for remove_none_attributes 2016-03-16 16:08:02 +01:00
b690755b84 Made utils.merge_dict None-safe, and removed lots of "thing or {}" 2016-03-11 10:24:19 +01:00
9284671ca7 PEP8 formatting 2016-03-11 10:23:46 +01:00
8a652ec455 Nuked the prints 2016-03-11 10:23:12 +01:00
379fee60a8 Added required projections on Node class 2016-03-09 17:32:11 +01:00
d9921667ce Replace Activity with ActivitySubscription 2016-03-09 16:56:50 +01:00