You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an idea to find the id of the page by space (key or title) and by page title. For a new page, the parent title could be given.
This would add a dependence (if I were to implement it) on jmespath. A search would have the following inputs:
space - interpreted as either space key or title
title - exact or approximate title of page
A method for an exact search:
deffind_page(session, baseurl, **kwargs):
cql_query_template= (
'type=page'' and (space="{space:s}" OR space.title~"{space:s}")'' and title="{title:s}"')
cql_query=cql_query_template.format(**kwargs)
response=session.get(baseurl+'/search', params={'cql': cql_query})
ifnotresponse.ok:
raiseSomething()
response_data=response.json()
ifresponse_data['size'] !=1:
returnNonepage_id=jmespath.search('results[0].content.id', response_data)
page_link=baseurl+'/content/'+page_idreturnpage_link
This could be generalized to support multiple "strategies", each a function taking the session, baseurl, and kwargs. This makes the search function more maintainable:
defcql_search_strategy(cql_query_template):
def_strategy(session, baseurl, **kwargs):
nonlocalcql_query_templatecql_query=cql_query_template.format(**kwargs)
response=session.get(baseurl+'/search', params={'cql': cql_query})
# ....return_strategyexact_title_strategy=cql_search_strategy('type=page and (space="{space:s}" OR space.title~"{space:s}") and title="{title:s}"')
title_contains_startegy=cql_search_strategy('type=page and (space="{space:s}" OR space.title~"{space:s}") and title~"{title:s}"')
The text was updated successfully, but these errors were encountered:
Now that I am more up-to-speed on the existing issues #3 and #4, I think it is more natural to have a wrapper script that calls nbconflux.api.notebook_to_page appropriately for my environment.
The search strategies would not be simple at all - what should the parent page be? In my corporate environment I may be able to specify the parent page for all my notebooks, but what about in some other environment.
I have an idea to find the id of the page by space (key or title) and by page title. For a new page, the parent title could be given.
This would add a dependence (if I were to implement it) on jmespath. A search would have the following inputs:
A method for an exact search:
This could be generalized to support multiple "strategies", each a function taking the session, baseurl, and kwargs. This makes the search function more maintainable:
The text was updated successfully, but these errors were encountered: