Getting HTTP Client error using the s3 client - object-storage

Operating system is Ubuntu 16.04
Python version is 3
Installed the AWS CLI using PIP
AWS CLI version is aws-cli/1.16.309 Python/3.6.9 Linux/4.20.17-042017-generic botocore/1.13.45
I set the HMAC creds correctly and type the following in my command line:
ncheaz#thinkburger:~/Projects/drupal-interact$ aws --endpoint-url 'https://control.cloud-object-storage.cloud.ibm.com/v2/endpoints' s3 ls
An HTTP Client raised and unhandled exception: __init__() got an unexpected keyword argument 'ssl_context'

Check your urllib3 version. Upgrading urllib3 to 1.25.11 (latest) solved the problem for me. https://pypi.org/project/urllib3/1.25.11/

You can load the urllib (or urllib3) module by loading it in the Python Interpreter and then checking it's version:
$ python
>>> import urllib
>>> urllib.__version__
'1.17'

Related

extJs 7.0.0 Community Edition - install docs not working

I'm on mac.
Following the guide here: https://docs.sencha.com/extjs/7.0.0-CE/guides/getting_started/mobile_desktop_application/getting_started_with_npm.html
I signed up for to the community edition, received the mail, created my sencha.myget.org account, and did the following commands successfully in a terminal:
step 1: login to npm repo
npm login --registry=https://sencha.myget.org/F/community/npm/ --scope=#sencha
step 2: install app generator cli
npm install -g #sencha/ext-gen
step 3: generate the app
ext-gen app -a
Now step 4 (run the new application) is where I have a problem:
cd my-app
npm start
Gives me this error:
If I open the log I can see the exception message:
/Users//Desktop/test/extjs/my-app/node_modules/#sencha/cmd/dist/plugin.xml:378: The following error occurred while executing this line:
/Users/me/Desktop/test/extjs/my-app/build.xml:15: Unable to create javax script engine for javascript
What am I doing wrong?
So this is how I did it on mac 10.14.
Ok, so reading about javax, apparently it was used in java se8 (https://docs.oracle.com/javase/8/docs/api/javax/script/ScriptEngine.html).
So, I downloaded it using this website: https://adoptopenjdk.net/,
and more precisely this page: https://adoptium.net/?variant=openjdk8.
Once downloaded, I had multiple versions of java installed on my computer and so I had to switch to that one.
So I learned how to switch to any java versions.
First to display the existing versions, type this in the terminal:
/usr/libexec/java_home -V
Then to change version:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
(notice that for the version number you just type the first two digits, not the whole version number )
To check that it worked:
java -version
Once java 1.8 (apparently that's the version name for jdk8) was running, the npm start command worked without errors.
You need to downgrade Java to any version less than 15, because the Nashorn JavaScript Engine had been removed, which it depends upon. Downgrading Java as far as version 8 probably isn't the optimum (in particular, when also using it for Java development).

How to access Google Cloud Bucket from development Environment

I am trying to access my Google Cloud Bucket from development environment but when I write import statement I get error
from google.cloud import storage
Command I use to run server with bucket flag
dev_appserver.py app.yaml --default_gcs_bucket_name ABC-test-bucket
Error I get
File "C:\Users\ABC\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\setuptools-0.6c11\pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
DistributionNotFound: google-cloud-storage
I think I completed all the steps like creating bucket, downloading client library using pip i.e.
pip install GoogleAppEngineCloudStorageClient -t <your_app_directory/lib>
I am new to GAE projects(Using Webapp2 Python framework for server) so I will really appreciate any pointers and help
The library you're using is not the correct one. You need the one below, as per the documentation:
pip install --upgrade google-cloud-storage

Pandas and Numpy Import error when using Apache2, Anaconda and Django

Am getting the following error - Missing required dependencies ['numpy']
Standalone and via Django, without Apache2 integration - the code work likes charm, however things start to fall when used with Apache2. It refuses to import pandas or numpy giving one error after another.
I am using Apache2, libapache2-mod-wsgi-py3, Python 3.5 and Anaconda 2.3.0
Request Method: GET
Request URL: http://127.0.0.1/api/users/0/
Django Version: 1.10.5
Exception Type: ImportError
Exception Value:
Missing required dependencies ['numpy']
Exception Location: /home/fractaluser/anaconda3/lib/python3.4/site-packages/pandas/__init__.py in <module>, line 18
Python Executable: /usr/bin/python3
Python Version: 3.5.2
Python Path:
['/home/fractaluser/anaconda3/lib/python3.4/site-packages',
'/home/fractaluser/anaconda3/lib/python3.4/site-packages/Sphinx-1.3.1-py3.4.egg',
'/home/fractaluser/anaconda3/lib/python3.4/site-packages/setuptools-27.2.0-py3.4.egg',
'/usr/lib/python35.zip',
'/usr/lib/python3.5',
'/usr/lib/python3.5/plat-x86_64-linux-gnu',
'/usr/lib/python3.5/lib-dynload',
'/usr/local/lib/python3.5/dist-packages',
'/usr/lib/python3/dist-packages',
'/var/www/html/cgmvp']
Server time: Fri, 9 Jun 2017 11:12:37 +0000
You can't force mod_wsgi built with the system Python version to use a Python virtual environment built for a different Python version, nor different Python installation. That is what it appears you are doing. You would need to uninstall mod_wsgi and install it from source code, compiling it against the Anaconda Python distribution. Best to use the pip install method and follow steps to integrate it into existing Apache installation. See:
https://pypi.python.org/pypi/mod_wsgi
Also see the following documentation for setting up a Python virtual environment with mod_wsgi, as it appears you aren't doing that in the recommended way either.
http://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html
First task though is to reinstall mod_wsgi.
I had the same problem using apache2 with mod_wsgi python 3.6 envinronmet 64, the version numpy used was 1.13, only change the version with previous and worked !!.
pip3 install numpy==1.12

Dronekit python vehicle connect timeout

I am trying to run a helloworld.py using dronekit on my solo drone.
My environment is
dronekit==2.7.0
pymavlink>=2.0.0
When I try to run the simple helloworld example the vehicle.connect() timesout.
ERROR LOADING MAVNATIVE - falling back to python implementation
Connecting to udpin:0.0.0.0:14550...
>>> Link timeout, no heartbeat in last 5 seconds
>>> No heartbeat in 30 seconds, aborting.
Traceback (most recent call last):
File "/log/solo-script/helloworld.py", line 9, in <module>
vehicle = connect("0.0.0.0:14550", wait_ready=True, baud=57600, heartbeat_timeout=30)
File "/log/solo-script/env/lib/python2.7/site-packages/dronekit/__init__.py", line 2787, in connect
vehicle.initialize(rate=rate, heartbeat_timeout=heartbeat_timeout)
File "/log/solo-script/env/lib/python2.7/site-packages/dronekit/__init__.py", line 2060, in initialize
raise APIException('Timeout in initializing connection.')
dronekit.APIException: Timeout in initializing connection.
I have tried downgrading pymavlink to 1.1.73 as well, but did not work. Any help is much appreciated.
I had the same problem.After downgrading pymavlink also build older version of dronekit. I used 2.0.0 and its worked.Here is a link for dronekit versions: https://github.com/dronekit/dronekit-python/releases
Make sure you are using python2. Dronekit uses pymavlink and dronekit code have been changed to python3 but pymavlink has given me a lot of issues in python3 and it works fine in python2.
It looks like an issue in vehicle.initialize method however try to set wait_ready=False, If it works then your solo it's not sending the parameters that dronekit is expecting:
# Default parameters when calling wait_ready() or wait_ready(True).
self._default_ready_attrs = ['parameters', 'gps_0', 'armed', 'mode', 'attitude']
Try updating your solo firmware and getting the latest dronekit and pymavlink versions from their git repo.

Google API access using Service Account oauth2client.client.CryptoUnavailableError: No crypto library available

I am trying to create a service account app so that I can access Google Analytics api using Python.
Two things are confusing me. First, when I use the following code:
`from oauth2client.client import SignedJwtAssertionCredentials
client_email = "#####client_email#######.gserviceaccount.com"
with open("XXXXXX.p12") as f:
private_key = f.read()
credentials = SignedJwtAssertionCredentials(client_email, private_key,'https://www.googleapis.com/auth/sqlservice.admin')`
I get the following error:
`oauth2client.client.CryptoUnavailableError: No crypto library available`
After doing a little research I found that this might have to do with granting the app domain-wide authority to the service account. However, when I log on to the Google Developers Console I cannot locate the security icon or the more-options button. Any help much appreciated thank you.
This did the trick for me (without converting to PEM):
pip install PyOpenSSL
pip freeze says I have version 0.15.1
That error probably means you need the python-openssl package.
apt-get install python-openssl
Even if you are installed pycrypto & python-ssl libraries in your development environment, You need to add this pycrypto library in your application's app.yaml file.
libraries:
- name: pycrypto
version: "latest"
I just recently set this up but opted to go with PyCrypto 2.6.1, but you can also use python-openssl as mentioned in the previous answer.
The only problem I had and I can't pinpoint this down, but the P12 key generated by the Google Developer Console wasn't working with my Service Account API call (to the Content API for Shopping), and I had to switch the key to the PEM format to get things going.
My setup: (Win7, python 2.7.x, PyCrypto 2.6.1)
The error I got when trying to use the P12 key, but later resolved when converting it to PEM:
Error 3: PKCS12 format is not supported by the PyCrypto library.
NotImplementedError: PKCS12 format is not supported by the PyCrypto library. Try converting to a “PEM” (openssl pkcs12 -in xxxxx.p12 -nodes -nocerts > privatekey.pem) or using PyOpenSSL if native code is an option.
One important thing, don't forget to go inside Google Analytics and grant the appropriate permissions for the client email address that is created during the creation of the Service Account.
OSX 10.11 El Capitan does not distribute OpenSSL anymore. I was able to install cryptography using Homebrew and static build:
env CRYPTOGRAPHY_OSX_NO_LINK_FLAGS=1 LDFLAGS="$(brew --prefix openssl)/lib/libssl.a $(brew --prefix openssl)/lib/libcrypto.a" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography
More info
http://cryptography.readthedocs.org/en/latest/installation/

Resources