Code Monkey home page Code Monkey logo

Comments (6)

vrillusions avatar vrillusions commented on September 17, 2024

👍 well not for hardcoding config but a way to manually specify the config file.

Basically change this (I've removed some comments to make it easier to read)

class Bridge(object):
    def __init__(self, ip=None, username=None):
        if os.access(os.getenv(USER_HOME), os.W_OK):
            self.config_file_path = os.path.join(
                os.getenv(USER_HOME), '.python_hue')
        else:
            self.config_file_path = os.path.join(os.getcwd(), '.python_hue')

becomes

class Bridge(object):
    def __init__(self, ip=None, username=None, config_file_path=None):
        if config_file_path and os.access(config_file_path, os.W_OK):
            self.config_file_path = config_file_path
        else:
            if os.access(os.getenv(USER_HOME), os.W_OK):
                self.config_file_path = os.path.join(
                    os.getenv(USER_HOME), '.python_hue')
            else:
                self.config_file_path = os.path.join(os.getcwd(), '.python_hue')

I'm sure it can be done better. but idea is add an optional config_file_path so it can be specified at runtime

from phue.

sciguy14 avatar sciguy14 commented on September 17, 2024

@studioimaginaire - any thoughts on this? Want to chime in?

from phue.

natcl avatar natcl commented on September 17, 2024

Will be back in town next week and will have a look !

from phue.

sciguy14 avatar sciguy14 commented on September 17, 2024

Thanks!

Jeremy Blum
Blum Idea Labs, LLC.
http://www.jeremyblum.com

Sent from my phone, please excuse the brevity.
On Jan 24, 2014 5:10 PM, "Nathanaël Lécaudé" [email protected]
wrote:

Will be back in town next week and will have a look !


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-33276543
.

from phue.

natcl avatar natcl commented on September 17, 2024

Hmmm,
You could also just pass the username to the bridge object :
b = Bridge('192.168.1.xx', 'username')
where username is the hex key.
Would that be a suitable workaround ?

from phue.

sciguy14 avatar sciguy14 commented on September 17, 2024

That seems like a perfectly reasonable approach to me. Do you think you may loop that into a future release?

from phue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.