当前位置: 首页>>代码示例>>Python>>正文


Python Url.check_url方法代码示例

本文整理汇总了Python中linkcheck.models.Url.check_url方法的典型用法代码示例。如果您正苦于以下问题:Python Url.check_url方法的具体用法?Python Url.check_url怎么用?Python Url.check_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在linkcheck.models.Url的用法示例。


在下文中一共展示了Url.check_url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_external_check_302_followed

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_external_check_302_followed(self):
     """
     For temporary redirects, we do not report any redirection in `redirect_to`.
     """
     uv = Url(url="%s/http/redirect/302/" % self.live_server_url, still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, '200 OK')
     self.assertEqual(uv.redirect_to, '')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:11,代码来源:test_linkcheck.py

示例2: test_internal_check_media_utf8

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_internal_check_media_utf8(self):
     uv = Url(url="/media/r%C3%BCckmeldung", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, 'Working file link')
     # Also when the url is not encoded
     uv = Url(url="/media/rückmeldung", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, 'Working file link')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:12,代码来源:test_linkcheck.py

示例3: test_external_check_200_utf8

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_external_check_200_utf8(self):
     uv = Url(url="%s/http/200/r%%C3%%BCckmeldung/" % self.live_server_url, still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, '200 OK')
     # Also when the url is not encoded
     uv = Url(url="%s/http/200/rückmeldung/" % self.live_server_url, still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, '200 OK')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:12,代码来源:test_linkcheck.py

示例4: test_internal_check_view_redirect

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_internal_check_view_redirect(self):
     uv = Url(url="/admin/linkcheck", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, 'This link redirects: code 301 (Working redirect)')
     uv = Url(url="/http/brokenredirect/", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, False)
     redirect_code = 301 if django.VERSION < (1, 9) else 302
     self.assertEqual(uv.message, 'This link redirects: code %d (Broken redirect)' % redirect_code)
开发者ID:DjangoAdminHackers,项目名称:django-linkcheck,代码行数:12,代码来源:test_linkcheck.py

示例5: test_internal_check_media_utf8

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_internal_check_media_utf8(self):
     media_file = os.path.join(os.path.dirname(__file__), 'media', 'rückmeldung')
     open(media_file, 'a').close()
     self.addCleanup(os.remove, media_file)
     uv = Url(url="/media/r%C3%BCckmeldung", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, 'Working file link')
     # Also when the url is not encoded
     uv = Url(url="/media/rückmeldung", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, 'Working file link')
开发者ID:DjangoAdminHackers,项目名称:django-linkcheck,代码行数:15,代码来源:test_linkcheck.py

示例6: test_internal_check_blank

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_internal_check_blank(self):
     uv = Url(url="", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, False)
     self.assertEqual(uv.message, 'Empty link')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:7,代码来源:test_linkcheck.py

示例7: test_internal_check_mailto

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_internal_check_mailto(self):
     uv = Url(url="mailto:nobody", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, None)
     self.assertEqual(uv.message, 'Email link (not automatically checked)')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:7,代码来源:test_linkcheck.py

示例8: test_external_check_404

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_external_check_404(self):
     uv = Url(url="%s/whatever/" % self.live_server_url, still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, False)
     self.assertEqual(uv.message.lower(), '404 not found')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:7,代码来源:test_linkcheck.py

示例9: test_external_check_404

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_external_check_404(self):
     uv = Url(url="http://qa-dev.w3.org/link-testsuite/http.php?code=404", still_exists=True)
     uv.check_url()
     self.assertEquals(uv.status, False)
     self.assertEquals(uv.message, '404 Not Found')
开发者ID:Ixxy-Open-Source,项目名称:django-linkcheck-old,代码行数:7,代码来源:test_linkcheck.py

示例10: test_external_check_301_followed

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_external_check_301_followed(self):
     uv = Url(url="%s/http/redirect/301/" % self.live_server_url, still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, '301 OK')
     self.assertEqual(uv.redirect_to, '%s/http/200/' % self.live_server_url)
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:8,代码来源:test_linkcheck.py

示例11: test_external_check_301

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_external_check_301(self):
     uv = Url(url="%s/http/301/" % self.live_server_url, still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, False)
     self.assertEqual(uv.message.lower(), '301 moved permanently')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:7,代码来源:test_linkcheck.py

示例12: test_external_check_301

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_external_check_301(self):
     uv = Url(url="http://qa-dev.w3.org/link-testsuite/http.php?code=301", still_exists=True)
     uv.check_url()
     self.assertEquals(uv.status, False)
     self.assertEquals(uv.message, '301 Moved Permanently')
开发者ID:Ixxy-Open-Source,项目名称:django-linkcheck-old,代码行数:7,代码来源:test_linkcheck.py

示例13: test_internal_check_found

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_internal_check_found(self):
     uv = Url(url="/public/", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, 'Working internal link')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:7,代码来源:test_linkcheck.py

示例14: test_internal_check_anchor

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_internal_check_anchor(self):
     uv = Url(url="#some_anchor", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, None)
     self.assertEqual(uv.message, 'Link to within the same page (not automatically checked)')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:7,代码来源:test_linkcheck.py

示例15: test_internal_check_media_found

# 需要导入模块: from linkcheck.models import Url [as 别名]
# 或者: from linkcheck.models.Url import check_url [as 别名]
 def test_internal_check_media_found(self):
     uv = Url(url="/media/found", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, 'Working file link')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:7,代码来源:test_linkcheck.py


注:本文中的linkcheck.models.Url.check_url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。