Conversation
To allow for the cookie from the reverse proxy to propogate through the bioblend API requests - still need to do for all other requests Good start through
nsoranzo
left a comment
There was a problem hiding this comment.
Thanks for opening the PR! Can you also have a look at the linting errors (the test failures are about to be fixed in the main branch).
TypeError: typing.Optional requires a single type. Got <requests.sessions.Session object at 0x101161040>.
nsoranzo
left a comment
There was a problem hiding this comment.
Looking good! A few more suggestions for your example scripts.
|
|
||
| with requests.Session() as session: | ||
| session.cookies = cookie_jar | ||
| session.verify = True |
There was a problem hiding this comment.
This is the default:
| session.verify = True |
| GALAXY_KEY = "user_api_key" | ||
| WORKFLOW_NAME = "workflow_name" |
There was a problem hiding this comment.
Move these 2 constants to the top with the other constants?
| from bioblend.galaxy import GalaxyInstance | ||
|
|
||
|
|
||
| def get_inputs(server, api_key, workflow_name, session=None): |
There was a problem hiding this comment.
| def get_inputs(server, api_key, workflow_name, session=None): | |
| def get_inputs(gi, workflow_name): |
| Usage: | ||
| get_inputs( | ||
| server = "galaxy.server.org", | ||
| api_key = "user_api_key", | ||
| workflow_name = "workflow_name", | ||
| ) | ||
|
|
There was a problem hiding this comment.
| Usage: | |
| get_inputs( | |
| server = "galaxy.server.org", | |
| api_key = "user_api_key", | |
| workflow_name = "workflow_name", | |
| ) |
| server (string): Galaxy server address | ||
| api_key (string): User generated string from galaxy instance | ||
| to create: User > Preferences > Manage API Key > Create a new key |
There was a problem hiding this comment.
| server (string): Galaxy server address | |
| api_key (string): User generated string from galaxy instance | |
| to create: User > Preferences > Manage API Key > Create a new key | |
| gi: GalaxyInstance object |
| print(response) | ||
|
|
||
| print("Getting inputs for a workflow") | ||
| response = get_inputs(f"https://{API_HOSTNAME}", GALAXY_KEY, WORKFLOW_NAME, session=session) |
There was a problem hiding this comment.
| response = get_inputs(f"https://{API_HOSTNAME}", GALAXY_KEY, WORKFLOW_NAME, session=session) | |
| response = get_inputs(gi, WORKFLOW_NAME) |
| Usage: | ||
| get_workflows( | ||
| server = "galaxy.server.org", | ||
| api_key = "user_api_key", | ||
| ) | ||
|
|
There was a problem hiding this comment.
| Usage: | |
| get_workflows( | |
| server = "galaxy.server.org", | |
| api_key = "user_api_key", | |
| ) |
| return inputs | ||
|
|
||
|
|
||
| def get_workflows(server, api_key, session=None): |
There was a problem hiding this comment.
| def get_workflows(server, api_key, session=None): | |
| def get_workflows(gi): |
| Returns: | ||
| workflows (array of strings): Workflows available to be run on the galaxy instance provided | ||
| """ | ||
| gi = GalaxyInstance(url=server, key=api_key, session=session) |
There was a problem hiding this comment.
| gi = GalaxyInstance(url=server, key=api_key, session=session) |
| server (string): Galaxy server address | ||
| api_key (string): User generated string from galaxy instance | ||
| to create: User > Preferences > Manage API Key > Create a new key |
There was a problem hiding this comment.
| server (string): Galaxy server address | |
| api_key (string): User generated string from galaxy instance | |
| to create: User > Preferences > Manage API Key > Create a new key | |
| gi: GalaxyInstance object |
|
@williamjsmith15 I was thinking, what if we pass |
Adds session handling for the BioBlend API library so that cookies can be used for an authentication layer external to Galaxy.
Fixes #480
Example of use in the docs/examples/session_handling/cookie_handler.py script. Note: this would need a Galaxy instance configured behind an authentication system.