url with passwords doesn't work for me

peszko
Posts: 311
Joined: Wed Mar 07, 2012 5:37 pm

url with passwords doesn't work for me

Post by peszko »

Hello,

I'm trying to access Hikvision NVR to get its camera's images. The URLs work in Indigo directly, but not through this plugin. I use the format:

http://username:password@nvrip/ISAPI/St ... 01/picture

This works when used in indigo in the refreshing image url controll, but I get a 401 with the plugin.

Any help appreciated.
peszko
Posts: 311
Joined: Wed Mar 07, 2012 5:37 pm

Re: url with passwords doesn't work for me

Post by peszko »

Hello,

Ok I fixed my problem. The issue is that my NVR was expecting digest authentication and this plugin doesn't support it.

So there are two solutions, turn off digest authentication or modify the plugin. Sine, I think digest is a better choice, I modified the plugin.

I changed the request as follows:

r = requests.get(url, stream=True, timeout=100, auth=HTTPDigestAuth(parsed.username, parsed.password))

You still need to import the HTTPDigestAuth

from requests.auth import HTTPDigestAuth

Possibly the author could add support for couple most used authentication methods.

Thanks.
vtmikel
Posts: 646
Joined: Fri Aug 31, 2012 12:45 pm
Location: Boston, MA
Contact:

Re: url with passwords doesn't work for me

Post by vtmikel »

Thanks, I'll add this to my list to do.
vtmikel
Posts: 646
Joined: Fri Aug 31, 2012 12:45 pm
Location: Boston, MA
Contact:

Re: url with passwords doesn't work for me

Post by vtmikel »

Just to confirm, this is a general URL download and not SecuritySpy, correct? I dont think SecuritySpy supports Digest.
peszko
Posts: 311
Joined: Wed Mar 07, 2012 5:37 pm

Re: url with passwords doesn't work for me

Post by peszko »

Yes, this is the generic download from a Hikvision NVR. I have created my own plugin now to support the NVR directly. I didn't post it in the PluginStore, but if there is interest, I can. I'd just need to add some end user niceties such as version controll and better input checking.
peszko
Posts: 311
Joined: Wed Mar 07, 2012 5:37 pm

Re: url with passwords doesn't work for me

Post by peszko »

Since move to python 3, my plugin doesn't work and I don't have time to upgrade it. But coming back to security spy plugin, again download doesn't work with the url passwords. is there a way to authenticate u sing image downloaded and security spy helper?
peszko
Posts: 311
Joined: Wed Mar 07, 2012 5:37 pm

Re: url with passwords doesn't work for me

Post by peszko »

Hello,

I have ended up just upgrading my plugin as it was easier then I expected.. Anyway, I think Its a good idea to include digest authentication.

I believe that in your plugin, you could just adjust line 153. What I've done to make it work is change the line to add the auth parameter:

r = requests.get(url, stream=True, timeout=100, auth=HTTPDigestAuth(self.securityspy_login, self.securityspy_pass))
vtmikel
Posts: 646
Joined: Fri Aug 31, 2012 12:45 pm
Location: Boston, MA
Contact:

Re: url with passwords doesn't work for me

Post by vtmikel »

Wow I'm really delinquent in getting this added, my apologies. I'll get it added in so that you don't have to keep modifying each time.
sbe08
Posts: 30
Joined: Thu Sep 14, 2006 7:53 pm

Re: url with passwords doesn't work for me

Post by sbe08 »

I had an issue when updating to Indigo 2023.2 and the latest version of the plug-in. The modification you made at line 152 makes it so that the credentials are included twice in the URL and lead to a 401 error.

I had to replace:

Code: Select all

			r = requests.get(url, stream=True, timeout=100, auth=HTTPDigestAuth(self.securityspy_login, self.securityspy_pass))

With this to make it work again.

Code: Select all

			r = requests.get(url, stream=True, timeout=100)
(I do use credentials (username and password) entered in the plug-in configuration.
colin_d
Posts: 34
Joined: Sat Nov 08, 2014 11:46 am
Location: East Sussex

Re: url with passwords doesn't work for me

Post by colin_d »

Great

That little tweak worked for me too! :D

Thanks
vtmikel
Posts: 646
Joined: Fri Aug 31, 2012 12:45 pm
Location: Boston, MA
Contact:

Re: url with passwords doesn't work for me

Post by vtmikel »

This has been addressed in the latest beta.
Post Reply

Return to “Security Spy Helper”