Closed and712 closed 4 years ago
Hey @and712 what was the hostname you supplied to farmOS.py? Looks like it was farmos.local
?
If so, try http://farmos.local
. You could also try http://localhost
- this should be the same that you use to visit in the browser. You can also try supplying https://
explicitly.
I'm also curious - were you connecting via OAuth or Drupal Credentials? (You would need to explicitly pass a client_id
to farmOS.py if using OAuth. I ask because to use OAuth with HTTP, you must also configure the OAUTHLIB_INSECURE_TRANSPORT
environment variable to be True
)
Can you share some of the code you are using to instantiate farmOS.py?
Just getting another chance to think about this in regard to HTTPS
... first, I would test and make sure you can load farmOS by going to https://farmos.local
in your browser. If that doesn't work, then it seems like your certs may be configured incorrectly.
In the past I have had issues with SSL and Python, but the issue was a remote server that didn't support the latest versions of SSL, and the dependencies required for that SSL version not being installed locally... BUT that was unrelated to farmOS so I would be surprised if that is the problem here.
Good Morning :) Thank you for your fest response!
the url i connect to depends on if the reverse proxy is running or not. I didnt used the http:// or the https:// till now.
My command is just to run the test.py
python .\test.py
the test.py file looks like this for localhost
from farmOS import farmOS
hostname = "localhost"
username = "myusername"
password = "mysecurepassword"
farm_client = farmOS(
hostname=hostname,
username=username,
password=password,
)
and for the nginx config
from farmOS import farmOS
hostname = "farmos.local"
username = "myusername"
password = "mysecurepassword"
farm_client = farmOS(
hostname=hostname,
username=username,
password=password,
)
If so, try http://farmos.local. You could also try http://localhost - this should be the same that you use to visit in the browser. You can also try supplying https:// explicitly.
Sadly this didnt make any change with the nginx config enabled
Just getting another chance to think about this in regard to HTTPS... first, I would test and make sure you can load farmOS by going to https://farmos.local in your browser. If that doesn't work, then it seems like your certs may be configured incorrectly.
with chrome i can connect with https, but i also have installed the created cert. I think there is a problem between python, windows and knowing the certs.
The only Stackoverflow issue i found to that problem on Windows was this https://stackoverflow.com/questions/51925384/unable-to-get-local-issuer-certificate-when-using-requests-in-python/51925474 But i couldnt get it running with that help.
I think there is a problem between python, windows and knowing the certs.
Thanks for the info @and712 ! I agree, this seems to be the problem.
I just found this: https://stackoverflow.com/questions/30405867/how-to-get-python-requests-to-trust-a-self-signed-ssl-certificate
With requests it looks like you can specify a cert with an environment variable:
export REQUESTS_CA_BUNDLE=/path/to/your/certificate.pem
python script.py
Normally you could specify the verify
parameter directly in the requests call, but farmOS.py doesn't allow that parameter to be set.
r = requests.post(url, data=data, verify='/path/to/public_key.pem')
Hopefully the environment variable will work?
It didn't really helped me out. I couldn't get it to work till now, but i deployed my main server some days ago with a "real" cert. So the problem isn't solved for connection to a dev server, but this is more a python/windows problem then a problem with farmOS.py bib.
@and712 glad to hear it's working with the deployed server. I haven't worked with local certs during development all that much. If I find myself doing so with farmOS I'll try and remember to test farmOS.py with it. But unfortunately I can't test it on Windows
Please report back if you are able to figure it out!
i invested some more time into this and came to the conclusion that it is a bad idea to use docker on windows. All problems i run into had nothing to do with farmOS or farmOS.py. It was just that many containers are not running well on windows or docker commands are not available on windows.
Solution: Dont use Docker on Windows. Setup a Linux VM and everything works fine :)
Hi :) today i tried to setup the farmOS.py project and connect to my local farmOS docker, but then i run into the following error:
Because of the 433 error i tried to use the reverse proxy config and installed the certs on my machine, but the error didnt change.
Also i don't really know were to search for the error. I tried to google it, but i have no clue what python component is used for the connection..
Probably the fix is really, like putting the certs in the right directory?
Full error log: