Spotipy Error: nodename nor servname provided, or not known - python-3.x

I've been running my pipeline that uses spotipy to get spotify information every day for a while now, and just this morning I'm getting this error. Is anybody else having the same problem / have any ideas as to what's going on?
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 565, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='accounts.spotify.com', port=443): Max retries exceeded with url: /api/token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x120f558b0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))

Related

Error while downloading a repo from Hugging Face : Read timed out

I’m trying to download a repo from huggingface using this code:
from huggingface_hub import snapshot_download
snapshot_download(repo_id="openclimatefix/era5-land", repo_type="dataset",
cache_dir="/home/saben1/scratch/o/slurms/data_4")
After 3 hours of running, the repo wasn't completely downloaded and I got this error:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='cdn-lfs.huggingface.co', port=443): Read timed out.
I added the parameter resume_download=True (to begin downloading from where it stops) and increased the etag_timeout like this:
from huggingface_hub import snapshot_download
snapshot_download(repo_id="openclimatefix/era5-land", repo_type="dataset",
cache_dir="/home/saben1/scratch/o/slurms/data_4", etag_timeout=120,
resume_download=True)
But still, have a new error:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/datasets/openclimatefix/era5-land/revision/main (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x2aba8ecc7070>: Failed to establish a new connection: [Errno 101] Network is unreachable'))

"Failed to establish a new connection" and "Cannot connect to proxy" with selenium

I try to use selenium with the following code.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import chromedriver_binary
options = Options()
options.add_argument('--headless')
options.add_argument('--no-proxy-server')
dv = webdriver.Chrome(options=options);
Then I've got the following error.
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port
=8080): Max retries exceeded with url: http://localhost:55826/session (Caus
ed by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.c
onnection.HTTPConnection object at 0x000001945B58F070>: Failed to establish
a new connection: [WinError 10061]
I don't use any proxies and I don't even try to connect to anywhere yet. What is wrong with my code?
Here is my environment.
Python 3.10.4
Chrome 99.0.4844.74
chromedriver-binary 99.0.4844.51

Python API call fails with [SSL: SSLV3_ALERT_BAD_RECORD_MAC] sslv3 alert bad record mac (_ssl.c:1125)')))

I recently "moved" to a new laptop (MacOS Monterey 12.2.1), and since then, my (very simple) API call does work anymore.
It worked fine before, and the VM where the same app is running also works fine.
I first thought I was backlisted, but I can still access the same API via Postman.
Minimum Example
import requests
from requests.auth import HTTPBasicAuth
requests.get("URL", auth=HTTPBasicAuth("XXX", "YYYU"))
Obviously, XXX and YYY is not the real authentication ;-)
The error I get is:
File ~/Library/Python/3.8/lib/python/site-packages/requests/adapters.py:517, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
513 raise ProxyError(e, request=request)
515 if isinstance(e.reason, _SSLError):
516 # This branch is for urllib3 v1.22 and later.
--> 517 raise SSLError(e, request=request)
519 raise ConnectionError(e, request=request)
521 except ClosedPoolError as e:
SSLError: HTTPSConnectionPool(host='www.sportdata.org', port=443): Max retries exceeded with url: /ju-jitsu/rest/event/categories/257 (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_BAD_RECORD_MAC] sslv3 alert bad record mac (_ssl.c:1125)')))
I already tried with verify=False, but this did not help :-(
I must admit I am a bit lost :-(
Any suggestions and input are welcome.
Cheers,
Claudia

HTTPSConnectionPool(host='api.twitter.com', port=443): Max retries exceeded with url

I am trying to crawl Twitter with Twython, tweepy module according to their documentation. Each time got stuck along with max entries restrictions:
#python 3.8.2
#twython 3.8.2
from twython import Twython
twitter = Twython(APP_KEY, APP_SECRET,
OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
twitter.verify_credentials(verify = False)
twitter.get_home_timeline()
Error
twython.exceptions.TwythonError: HTTPSConnectionPool(host='api.twitter.com', port=443): Max retries exceeded with url: /1.1/account/verify_credentials.json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fa1b4d86100>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
Any suggestions What I am missing?
You get this error simply because twitter is filtered/prohibited in your area !
try connecting with proxy !

socket programming with python 3

I have a problem with this code, please help me solve it this code
is giving give me the following error:
socket.gaierror: [Errno 11001] getaddrinfo failed
import socket
servername='host'
serverport=12000
clientsocket=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
message=input('input:')
clientsocket.sendto(message.encode('ascii'),(servername,serverport))
modimess,serveraddress=clientsocket.recvfrom(2048)
print(modimess)
clientsocket.close()

Resources