Вот кусок пост запроса из снифера HTTPFox:
viewTarget=viewer&viewPlace=community.profile&context=YTowOnt9&noCycling=true&ownerId=332295&ajax=1&pinId=452931651&_fs2ajax=1
value = { 'viewTarget':'viewer', 'viewPlace':'community.profile', 'context':'YTowOnt9', 'noCycling':'true', 'ownerId':'332295', 'ajax':'1', 'pinId':'452931651', '_fs2ajax':'1', }
headers = {
'(Request-Line)':'GET / HTTP/1.1',
'Host':'fotostrana.ru',
'User-Agent' : 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:34.0) Gecko/20100101 Firefox/34.0',
'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language' : 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
'Accept-Encoding' : 'gzip, deflate',
'Referer' : 'http://fotostrana.ru/public/post/332295/452931651/',
'Cookie' :'',
'Connection' : 'keep-alive'
}Собственно сам код:
# -*- coding: utf-8 -*- from grab import Grab import time, random import logging logger = logging.getLogger('grab') logger.addHandler(logging.StreamHandler()) logger.setLevel(logging.DEBUG) headers = { '(Request-Line)':'GET / HTTP/1.1', 'Host':'fotostrana.ru', 'User-Agent' : 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:34.0) Gecko/20100101 Firefox/34.0', 'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language' : 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3', 'Accept-Encoding' : 'gzip, deflate', #'Referer' : 'http://fotostrana.ru/public/post/332295/452931651/', 'Cookie' :'', 'Connection' : 'keep-alive' } value = { 'viewTarget':'viewer', 'viewPlace':'community.profile', 'context':'YTowOnt9', 'noCycling':'true', 'ownerId':'332295', 'ajax':'1', 'pinId':'452931651', '_fs2ajax':'1', } g = Grab(headers = headers) g.setup(hammer_mode=True, hammer_timeouts=((2, 5), (10, 15), (20, 30))) g.go('http://fotostrana.ru/signup/login/', log_file='outtest.html') g.choose_form(1) g.set_input("user_email", '*****') g.set_input("user_password", '******') g.submit() g.setup(post=value) g.go('http://fotostrana.ru/pin/add-like/')
Ошибка вываливается в outlog.html
{"ret":0,"errors":[{"data":{"text":"\u041e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430."},"callback":"unknownError"}]}Как мне все таки лайкнуть этот пост? Ошибка выше как я понял это ошибка сервера.