Skip to content

Commit

Permalink
Updated README to reflect UrlFilters with time now doing the conversi…
Browse files Browse the repository at this point in the history
…on automatically
  • Loading branch information
Bryant Howell committed Dec 9, 2019
1 parent 4c231a6 commit d5c52db
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,20 @@ The following lists all of the available factory methods (although check with th

`UrlFilter27.get_hits_total_filter(operator, hits_total)`

Note that times must be specified with a full ISO 8601 format as shown below;
Note that times must be specified with a full ISO 8601 format as shown below, however you can just pass a datetime.datetime object and the methods will convert automatically

Ex.

import datetime
# t = TableauServerRest...
bryant_filter = t.url_filters.get_owner_name_filter('Bryant')
t_filter = t.url_filters.get_tags_filter(['sales', 'sandbox'])
ca_filter = t.url_filters.get_created_at_filter('gte', '2016-01-01T00:00:00:00Z')
# If you manually want to set this time format:
# ca_filter = t.url_filters.get_created_at_filter('gte', '2016-01-01T00:00:00:00Z')
now = datetime.datetime.now()
offset_time = datetime.timedelta(days=1)
time_to_filter_by = now - offset_time
ca_filter = t.url_filters.get_created_at_filter('gte', time_to_filter_by)
t.workbooks.query_workbooks(owner_name_filter=bryant_filter, tags_filter=t_filter, created_at_filter=ca_filter)

There is also a Sort object, but it is best to use the static factory methods through the `.sorts` property of the main REST connection objects:
Expand Down

0 comments on commit d5c52db

Please sign in to comment.