SORU
13 Kasım 2009, Cuma


Python urllib nasıl eğer bir web sitesi 404 veya 200 olup olmadığını görmek için kullanılır?

Nasıl urllib ile başlıkları kodu almak için?

CEVAP
13 Kasım 2009, Cuma


Bu getcode() yöntemi (python2 Eklendi.6) HTTP URL, HTTP URL ise yanıt, ya da Hiçbiri ile gönderilen durum kodu döndürür.

>>> a=urllib.urlopen('http://www.google.com/asdfsf')
>>> a.getcode()
404
>>> a=urllib.urlopen('http://www.google.com/')
>>> a.getcode()
200

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Doc Adams

    Doc Adams

    20 HAZİRAN 2007
  • efaustus9

    efaustus9

    16 HAZİRAN 2006
  • fouseyTUBE

    fouseyTUBE

    21 Mart 2011