Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved doc string for jp_fetch to include how to provide query parameters in GET and json data in POST #83

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
19 changes: 19 additions & 0 deletions pytest_jupyter/jupyter_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,25 @@ def jp_fetch(jp_serverapp, http_server_client, jp_auth_header, jp_base_url):
async def my_test(jp_fetch):
response = await jp_fetch("api", "spec.yaml")
...

With query parameters:

.. code-block:: python

async def my_test(jp_fetch):
response = await jp_fetch("api", "spec.yaml", params={"parameter": "value"})
...

A POST request with data:

.. code-block:: python

async def my_test(jp_fetch):
response = await jp_fetch(
"api", "spec.yaml", method="POST", body=json.dumps({"parameter": "value"})
)
...

"""

def client_fetch(*parts, headers=None, params=None, **kwargs):
Expand Down