0

How to access the current Shotgun connection parameters?

I'm writing a python package which relies on data from the shotgun integration package. Specifically, I need to know what the shotgun's current connection URL is. After doing some research I think this cannot be done without getting dirty. 

 

Any ideas?

Thanks.

4 comments

  • 0
    Avatar
    Jon Morley

    Hi José,

    If RV is connected to Shotgun then you should be able to use the following to locate that information:

    try:
        from pymu import MuSymbol
        print "_url", MuSymbol('shotgun_mode.theMode')()['_shotgunState']['_serverURL']
    except:
        print("ERROR: Could not get Shotgun URL!")

    Hope that helps. Please let us know.

    Thanks,
    Jon

  • 0
    Avatar
    José M. Calvo

    Yes this worked.

    Thanks :)

    Jose M.

     

  • 0
    Avatar
    Jon Morley

    Awesome!

  • 1
    Avatar
    (Michael) Kessler

    It was recently brought up that this doesn't provide the desirable server if you have multiple servers.  With RV+Shotgun (starting around Version 6), we started managing licenses a bit differently.  You can now use:



    from pymu import MuSymbol
    sessionData = MuSymbol("slutils.retrieveSessionsData")
    getServerUrl = MuSymbol("slutils.getServerUrlFromSession")

    # Ask for current session data, get the first one which is the active one, then extract the server url.
    print getServerUrl(sessionData()[0])

     

Please sign in to leave a comment.