Giter Site home page Giter Site logo

apc-smartconnect-py's People

Contributors

datagutten avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

apc-smartconnect-py's Issues

Cannot connect (AttributeError: 'NoneType' object has no attribute 'group')

Seems something is wrong:

Traceback (most recent call last):
  File "/home/xxx/apc-smartconnect-py/sample.py", line 11, in <module>
    smart.login(sys.argv[1], sys.argv[2])
  File "/home/xxx/apc-smartconnect-py/apc_smartconnect/APCSmartConnect.py", line 85, in login
    frontdoor = self.get_meta_redirect(response2.text)
  File "/home/xxx/apc-smartconnect-py/apc_smartconnect/APCSmartConnect.py", line 50, in get_meta_redirect
    url = matches.group(1)
AttributeError: 'NoneType' object has no attribute 'group'

Any idea why? UPS is visible on APC portal...

How do i use this?

Hi. How do i use this? I am trying your sample.py, but i keep getting an error:

/apc-smartconnect-py$ python3 sample.py 'myusername' 'mypassword
Traceback (most recent call last):
  File "/home/sutadmin/apc-poller/apc-smartconnect-py/sample.py", line 8, in <module>
    smart = APCSmartConnect('cookies.lwp')
TypeError: APCSmartConnect.__init__() takes 1 positional argument but 2 were given

URL error when calling gateways

Just a FYI, I had to modify sample.py to get it to call all the gateways correctly:

gateways_data = smart.gateways() # Fetch all gateways (UPSs)
for gateway in gateways_data["gateways"]:
pprint(smart.gateway_info(gateway["deviceId"]))

schneider maintenance mode crashes script output

hi, we have integrated your script into our icinga and we monitor a smart ups.

we've got that error message when the website was in maintenance mode, can you catch that error and configure the output to be warning?

Traceback (most recent call last):File "/usr/lib/nagios/plugins/apc-smartconnect/apc-smartconnect-info.py", line 12, in smart.login(sys.argv[1], sys.argv[2]) File "/usr/lib/nagios/plugins/apc-smartconnect/apc_smartconnect/APCSmartConnect.py", line 70, in login response = self.session.get(response.headers['Location']) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 555, in get return self.request('GET', url, **kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 528, in request prep = self.prepare_request(req) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 456, in prepare_request p.prepare( File "/usr/lib/python3/dist-packages/requests/models.py", line 316, in prepare self.prepare_url(url, params) File "/usr/lib/python3/dist-packages/requests/models.py", line 390, in prepare_url raise MissingSchema(error) requests.exceptions.MissingSchema: Invalid URL '/maintenance': No schema supplied. Perhaps you meant http:///maintenance?

thanks and have a great day!
cheers Ringo

I am clueless as to how to impliment this. Think I did it right but get the following error.

Not sure if how to make use of this.

Installed with pip.

Just copied your script:

import os
import tempfile

from apc_smartconnect import APCSmartConnect

cookies_temp = tempfile.NamedTemporaryFile()
apc = APCSmartConnect()
apc.login(os.getenv('APC_USER'), os.getenv('APC_PASS'))

def test_gateways():
gateways = apc.gateways()
assert type(gateways) == list
assert type(gateways[0]) == str

I get the following error:

Exception ignored in: <function APCSmartConnect.del at 0x000001FB10D20AE0>
Traceback (most recent call last):
File "C:\Users\EyonB\AppData\Local\Programs\Python\Python312\Lib\site-packages\apc_smartconnect\APCSmartConnect.py", line 42, in del
self.cookies.save()
^^^^^^^^^^^^
AttributeError: 'APCSmartConnect' object has no attribute 'cookies'
Traceback (most recent call last):
File "F:\Programming\Python\APC\APC.py", line 7, in
apc = APCSmartConnect()
TypeError: APCSmartConnect.init() missing 1 required positional argument: 'cookie_file'

Not really sure how to get around this. Now I'm assuming I could add a file and path to apc = APCSmartConnect( file and path) but as to what type of file to create and link is a bit foreign to me.

Not a programmer per se but trying to make use of this for collecting some data metrics.

Any help would be greatly appreciated.

Eyon

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.