Traceback (most recent call last):
File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 174, in _new_conn
conn = connection.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\connection.py", line 95, in create_connection
raise err
File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\connection.py", line 85, in create_connection
sock.connect(sa)
TimeoutError: [WinError 10060] Bağlanılan uygun olarak belli bir süre içinde yanıt vermediğinden veya kurulan
bağlantı bağlanılan ana bilgisayar yanıt vermediğinden bir bağlantı kurulamadı
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 363, in connect
self.sock = conn = self._new_conn()
^^^^^^^^^^^^^^^^
File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 179, in _new_conn
raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x000002767F916410>, 'Connection to www.vesselfinder.com timed out. (connect timeout=None)')
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='www.vesselfinder.com', port=443): Max retries exceeded with url: //vessels/details/9077549 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000002767F916410>, 'Connection to www.vesselfinder.com timed out. (connect timeout=None)'))
def shipsfeature():
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
}
dosya_adı= "shiplinks.txt"
dosya_adı1= "shipsfeatures.txt"
with open(dosya_adı, "r") as shiplinks:
with open(dosya_adı1, "w") as shipsfeatures:
ships = shiplinks.readlines()
for ship in ships:
response = requests.get(ship.strip(), headers=headers)
if response.status_code == 200:
soup = BeautifulSoup(response.content, "html.parser")
headlines =soup.find_all(class_="n3")
values =soup.find_all(class_="v3")
n = 1
while n<928:
if n % 2 ==0:
values_text =[value.get_text() for value in values]
shipsfeatures.write(" , ".join(values_text)+ "\n")
else:
headlines_text= [headline.get_Text() for headline in headlines]
shipsfeatures.write(" , ".join(headlines_text) + "\n")
n += 1
else:
print(f"Hata: {response.status_code} - İstek başarısız.")
python dosyalarını neden sileyimC:\Users\albur\AppData\Local\Programs\Python içindeki dosyaları silip tekrar denermisin birde aklıma gelen o klasörde yetki full mü.
site linki verirseniz kodu denemek istiyorum
Kodu ilk çalıştırdığımda verileri almıştım , 120mb lik bir txt dosyası şeklinde fakat artık siteyle bağlantı kuramıyor .kod bende çalışmadı herhangi bir hata vermedi ama verileri çekip shipfeatures dosyasına da kayıt etmedi
bende 64 kb boyutunda bi kayıt yaptı içini sildim tekrar denedim ve yine çalıştı her defasında 64kb boyutunda dosya oluştuKodu ilk çalıştırdığımda verileri almıştım , 120mb lik bir txt dosyası şeklinde fakat artık siteyle bağlantı kuramıyor .
Hocam başlangıçta çektiği dosya şubende 64 kb boyutunda bi kayıt yaptı içini sildim tekrar denedim ve yine çalıştı her defasında 64kb boyutunda dosya oluştu
fark ettim de sadece yılları çekmiş hocam sende de böyle demi
Bu hata, urllib3 ve requests modüllerini kullanarakŞöyle bir kod yazdım. İlk denediğimde verileri aldı fakat 2.kez denediğimde bağlantı hatası verdi . Şimdi de siteye giremiyorumne yapmam lazım . Yapay zekaya sor demeyin , sordum .
Textile:Traceback (most recent call last): File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 174, in _new_conn conn = connection.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\connection.py", line 95, in create_connection raise err File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\connection.py", line 85, in create_connection sock.connect(sa) TimeoutError: [WinError 10060] Bağlanılan uygun olarak belli bir süre içinde yanıt vermediğinden veya kurulan bağlantı bağlanılan ana bilgisayar yanıt vermediğinden bir bağlantı kurulamadı During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn conn.connect() File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 363, in connect self.sock = conn = self._new_conn() ^^^^^^^^^^^^^^^^ File "C:\Users\albur\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 179, in _new_conn raise ConnectTimeoutError( urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x000002767F916410>, 'Connection to www.vesselfinder.com timed out. (connect timeout=None)') raise ConnectTimeout(e, request=request) requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='www.vesselfinder.com', port=443): Max retries exceeded with url: //vessels/details/9077549 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000002767F916410>, 'Connection to www.vesselfinder.com timed out. (connect timeout=None)'))Python:def shipsfeature(): headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3" } dosya_adı= "shiplinks.txt" dosya_adı1= "shipsfeatures.txt" with open(dosya_adı, "r") as shiplinks: with open(dosya_adı1, "w") as shipsfeatures: ships = shiplinks.readlines() for ship in ships: response = requests.get(ship.strip(), headers=headers) if response.status_code == 200: soup = BeautifulSoup(response.content, "html.parser") headlines =soup.find_all(class_="n3") values =soup.find_all(class_="v3") n = 1 while n<928: if n % 2 ==0: values_text =[value.get_text() for value in values] shipsfeatures.write(" , ".join(values_text)+ "\n") else: headlines_text= [headline.get_Text() for headline in headlines] shipsfeatures.write(" , ".join(headlines_text) + "\n") n += 1 else: print(f"Hata: {response.status_code} - İstek başarısız.")
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?