git clone using GitPython library - ssl

How to clone with disabled SSL checking, using GitPython library. The following code ...
import git
x = git.Repo.clone_from('https://xxx', '/home/xxx/lala')
... yields this error:
Error: fatal: unable to access 'xxx': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
I know about "export GIT_SSL_NO_VERIFY=1", but how to implement it in a python library ?

The two following methods have been tested with GitPython 2.0.8 but should be working at least since 1.0.2 (from the doc).
As suggested by #Byron:
git.Repo.clone_from(
'https://example.net/path/to/repo.git',
'local_destination',
branch='master', depth=1,
env={'GIT_SSL_NO_VERIFY': '1'},
)
As suggested by #Christopher:
git.Repo.clone_from(
'https://example.net/path/to/repo.git',
'local_destination',
branch='master', depth=1,
config='http.sslVerify=false',
)

It seems easiest to pass the GIT_SSL_NO_VERIFY environment variable to all git invocations. Unfortunately Git.update_environment(...) can only be used on an existing instance, which is why you would have to manipulate python's environment like so:
import git
import os
os.environ['GIT_SSL_NO_VERIFY'] = "1"
repo = git.Repo.clone_from('https://xxx', '/home/xxx/lala')

Related

Error connecting to web server: Module not found: Can't resolve './RCTNetworking'

Failed to compile.
/Users/mohdjabiuddin/MNCL.DEV/MY-PROJECTS/renter-graphql/app/node_modules/react-native/Libraries/Network/XMLHttpRequest.js
Module not found: Can't resolve './RCTNetworking' in '/Users/jabiuddin/MNCL.DEV/MY-PROJECTS/renter-graphql/app/node_modules/react-native/Libraries/Network'
You probably have a problem with reactotron, I had the same problem with Ignite boilderplate from Infinite Red.
If so, you should install reactotron version for web.
Fast solution
Install reactotron-react-js and import it instead of reactotron-react-native:
yarn add -D reactotron-react-js
// import Tron from "reactotron-react-native"
import Tron from "reactotron-react-js"
Long term solution
Install reactotron-react-js:
yarn add -D reactotron-react-js
Add separate configuration for web and native
// reactotron.native.ts
import Tron from "reactotron-react-native"
...
// reactotron.web.ts
import Tron from "reactotron-react-js"
...
Thanks to metro bundle this configuration will be loaded depend on environment. Maybe you have to comment some other configuration (depends on Ignite version).

Avoid SSL verification error at work when using urllib3 library

Using urllib3 library at work throws an SSL verification error.
When I explicitly use urllib3, I know how to avoid it using
import urllib3
c = urllib3.HTTPSConnectionPool('10.0.3.168', port=9001, cert_reqs='CERT_NONE', assert_hostname=False)
c.request('GET', '/')
as explained in Ignore certificate validation with urllib3
But a library calls another library and it calls another and uses urllib3 inside it, I don't know how to avoid SSL verification. I think revising the code inside the .py files in the folder /somepath/anaconda3/lib/site-packages/urllib3 solves the problem but cannot find which part I should revise.
Try changing connectionpool.py file. Look for super().init method and change this line:
self.assert_hostname = assert_hostname
to
self.assert_hostname = False

Cannot install uasyncio package on esp32 using upip

I have been using uasyncio on ESP32-WROOM-32D. After all the testing, I am trying to use the firmware to my other boards but uasyncio is not installed by default with the micropython. I tried to install the package by
>rshell -p comX
>repl
>>> import upip
>>> upip.install('micropython-uasyncio')
but getting the following error:
Installing to: /lib/
Error installing 'micropython-uasyncio': list index out of range, packages may be partially installed
Please help!
This is most likely a network error. I traced the same error and found that usocket.getaddrinfo failed to return a sensible address, leading to a list out of range exception in the upip module (https://github.com/micropython/micropython/blob/master/tools/upip.py#L136).
Check your network configuration using:
import network
network.WLAN(network.STA_IF).ifconfig()
If settings are not correct, make sure you have reasonable settings by calling ifconfig with a tuple of 4 addresses (ip, mask, gateway, dns):
network.WLAN(network.STA_IF).ifconfig(("192.168.1.101", "255.255.255.0", "192.168.1.1", "8.8.8.8"))

I found that there is an error import path in saved_model.go

problem:
in github:
import (
"runtime"
"unsafe"
"github.com/golang/protobuf/proto"
tfpb "github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core"
)
what's this(tfpb "github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core") ?
I cannot find it in anywhere , so can my program
How can I solve this problem
there is details:
today I try to install tensorflow for Go and execute it, I use this cmd:
go get github.com/tensorflow/tensorflow/tensorflow/go
then i test tf for go:
go test github.com/tensorflow/tensorflow/tensorflow/go
(according with this site: tensorflow)
but i got this message:
cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core" in any of:
/home/go/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core (from $GOROOT)
/home/go_work/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core (from $GOPATH)
then i visit github then i cannot find this path , How can I solve this problem?
thanks for you guys.!
You can look at the similar issue on Github: 23257
So, there's no proper fix out there which is documented, until then you can try this out. I resolved my error using the following way:
Run go get github.com/tensorflow/tensorflow/tensorflow/go
package github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core: cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core" in any of:
/usr/local/Cellar/go/1.13.5/libexec/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core (from $GOROOT)
/Users/subhamsarkar/go/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core (from $GOPATH)
Above get surely fails to find the said package, but the repo is already cloned to your GOPATH
cd $GOPATH/src/github.com/tensorflow/tensorflow/tensorflow/go
git checkout r1.11
Now again run,
go get github.com/tensorflow/tensorflow/tensorflow/go
Reason: Discussion
Also, I believe you have installed the TensorFlow C library which is required for the TensorFlow Go package.
Note: I tested on
OS: MacOSX 10.15.2
Go version: go1.13.5 darwin/amd64
Since this issue isn't getting fixed, I decided to maintain a fork: https://github.com/galeone/tensorflow
go get github.com/galeone/tensorflow/tensorflow/go#r2.4-go
You can also use tfgo that depends on the fork and it allows a simplified usage of the Go bindings:
go get github.com/galeone/tfgo

Unable to update/add any package using PIP in python2.6

Python Version - Python 2.6.9
PIP Version - pip 8.1.2 from /usr/lib64/python2.6/site-packages (python 2.6)
I Tried using all the available options on stackoverflow, but nothing worked out for me !
I don't want to upgrade my Python and want to install packages
Whenever I run pip install <some package> it gives this error -
Collecting ndg-httpsclient
/usr/lib64/python2.6/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:318:
SNIMissingWarning: An HTTPS request has been made, but the SNI
(Subject Name Indication) extension to TLS is not available on this
platform. This may cause the server to present an incorrect TLS
certificate, which can cause validation failures. You can upgrade to a
newer version of Python to solve this. For more information, see
https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/usr/lib64/python2.6/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:122:
InsecurePlatformWarning: A true SSLContext object is not available.
This prevents urllib3 from configuring SSL appropriately and may cause
certain SSL connections to fail. You can upgrade to a newer version of
Python to solve this. For more information, see
https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning Could not fetch URL
https://pypi.python.org/simple/ndg-httpsclient/: There was a problem
confirming the ssl certificate: [Errno 1] _ssl.c:497:
error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert
protocol version - skipping Could not find a version that satisfies
the requirement ndg-httpsclient (from versions: ) No matching
distribution found for ndg-httpsclient
/usr/lib64/python2.6/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:122:
InsecurePlatformWarning: A true SSLContext object is not available.
This prevents urllib3 from configuring SSL appropriately and may cause
certain SSL connections to fail. You can upgrade to a newer version of
Python to solve this. For more information, see
https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning