TheJacksonLaboratory/ezomero

Create an "ezconnect" function

Closed this issue · 8 comments

I am lazy and hate the process of creating a conn object using BlitzGateway when I am in an interactive Python shell. Lets create a function to create the OMERO connection like:

  1. First look for some environment variables for username, password, host, port, etc.

  2. If nothing in env, fall back to look for a config file

  3. If no config file, prompt user for username, pw, host, etc. sort of like how the OMERO CLI does it.

Of course with the config file option, we should explicitly state in the docs that one should not put their password in a file in plaintext

How about working with a client object?
Most example code around is using a 'conn' object but what are the differences.

  • You may always get the connection from the client
  • I understand that the client is providing more feedback in case of error
  • ...

A close_connection should be added too

Thanks for the feedback, @juliomateoslangerak !

I don't suppose you would mind sharing a little code example of what you mean. It is very likely there are big gaps in my/our knowledge of OMERO. We're just generally used to using the BlitzGateway connection object because this is how OME does it in most of their tutorials

I also use BlitzGateway connection. But the code used by the scripting services uses the client object. more configurable? I feel there is something essential I'm missing. maybe a question for the image.sc forum.
https://github.com/ome/openmicroscopy/blob/develop/examples/OmeroClients/configuration.py

Hmm, I think I would stick with the BlitzGateway connection approach since we need to use conn objects anyway for most of the functions, and one has to include connection info regardless

Added in #15