Permalink
Browse files

Release 0.1.8 with Yandex support

  • Loading branch information...
nkuttler committed Dec 19, 2012
1 parent 8f6911e commit 27cebb36eddd54e2fae347c2cc7d2377aed0f525
View
@@ -10,6 +10,7 @@ Supported services:
- `Google Webmaster Tools <https://www.google.com/webmasters/tools/home>`_
- `Bing Webmaster Tools <https://ssl.bing.com/webmaster/Home/>`_
+- `Yandex Webmaster Tools <http://webmaster.yandex.com/>`_
- `Majestic SEO <https://www.majesticseo.com>`_
Usage
@@ -41,6 +42,7 @@ Add settings just as::
'bing': '<bing verification code>',
'google': '<google verification code>',
'majestic': '<majestic verification code>',
+ 'yandex': '<yandex verification code>',
}
The codes are alphanumeric and don't include suffixes like 'html', e.g.
@@ -58,14 +60,26 @@ Multiple codes for google an majestic are supported as well::
'<majestic verification code 1>',
'<majestic verification code 2>',
),
+ 'yandex': (
+ '<yandex verification code 1>',
+ '<yandex verification code 2>',
+ ),
}
As bing always accesses the same verification file I'm not sure if it's possible to support more than one code for it. Please let me know if yes and how, as I don't really use their tools.
+For Yandex only the .txt file method is supported, but adding support for .html
+should be trivial.
+
Changelog
=========
+0.1.8 (2012-12-19)
+------------------
+
+- Yandex Webmaster Tools support added.
+
0.1.7 (2012-05-07)
------------------
-Bugfix for multiple verification codes for one provider.
+- Bugfix for multiple verification codes for one provider.
@@ -26,4 +26,5 @@
'google': 'ffffffffffffffff',
'bing': 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
'majestic': 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
+ 'yandex': 'f0f0f0f0f0f0f0f0',
}
@@ -21,4 +21,8 @@
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
),
+ 'yandex': (
+ 'f0f0f0f0f0f0f0f0',
+ '1919191919191919',
+ ),
}
@@ -111,3 +111,47 @@ def test_mj_file_404s(self):
def _get_mj_url(self, code):
return '/MJ12_%s.txt' % code
+
+ # TODO look into refactoring this
+ def test_yandex_file_acces(self):
+ codes = settings.WEBMASTER_VERIFICATION['yandex']
+ if type(codes) == tuple:
+ for code in codes:
+ self._test_yandex_file_access(code)
+ else:
+ self._test_yandex_file_access(codes)
+
+ # TODO look into refactoring this
+ def _test_yandex_file_access(self, code):
+ url = self._get_yandex_url(code)
+ r = self.client.get(url)
+ self.assertEqual(
+ r.status_code,
+ 200,
+ "Couldn't access %s, got %d" % (url, r.status_code)
+ )
+ self.assertEqual(
+ r['Content-Type'],
+ 'text/plain',
+ "Got %s content type for text file" % r['Content-Type']
+ )
+
+ # TODO look into refactoring this
+ def test_yandex_file_404s(self):
+ bad_codes = (
+ '',
+ '012345678',
+ '0123456789ABCDEF0123456789ABCDEF',
+ )
+ for code in bad_codes:
+ url = self._get_yandex_url(code)
+ r = self.client.get(url)
+ self.assertEqual(
+ r.status_code,
+ 404,
+ "Could access %s for inexistent code, got %d" % (url, r.status_code)
+ )
+
+ # TODO look into refactoring this
+ def _get_yandex_url(self, code):
+ return '/yandex_%s.txt' % code
@@ -3,6 +3,7 @@
from views import GoogleVerificationView
from views import BingVerificationView
from views import MajesticVerificationView
+from views import YandexVerificationView
urlpatterns = patterns('',
@@ -21,4 +22,9 @@
MajesticVerificationView.as_view(),
name = 'majestic_verify'
),
+ url(
+ r'^yandex_(?P<code>[0-9a-f]{16}).txt$',
+ YandexVerificationView.as_view(),
+ name = 'majestic_verify'
+ ),
)
@@ -81,3 +81,8 @@ class BingVerificationView(MimeXMLMixin, VerificationView):
class MajesticVerificationView(MimeTextMixin, FileAccessMixin, VerificationView):
template_name = 'webmaster_verification/majestic_verify_template.txt'
provider = 'majestic'
+
+
+class YandexVerificationView(MimeTextMixin, FileAccessMixin, VerificationView):
+ template_name = 'webmaster_verification/yandex_verify_template.txt'
+ provider = 'yandex'

0 comments on commit 27cebb3

Please sign in to comment.