forge a random IP source address to avoid redirection to other website
This commit is contained in:
parent
43ec8a8a00
commit
c85176f9b1
1 changed files with 6 additions and 0 deletions
|
|
@ -17,6 +17,7 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from random import randint
|
||||
|
||||
from weboob.tools.browser import BaseBrowser
|
||||
|
||||
|
|
@ -41,6 +42,11 @@ class VoyagesSNCFBrowser(BaseBrowser):
|
|||
'http://(?P<country>\w{2})\.voyages-sncf.com/\w{2}/.*': ForeignPage,
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
BaseBrowser.__init__(self, *args, **kwargs)
|
||||
self.addheaders += (('X-Forwarded-For', '82.228.147.%s' % randint(1,254)),)
|
||||
|
||||
|
||||
def get_stations(self):
|
||||
self.location('/completion/VSC/FR/fr/cityList.js')
|
||||
return self.page.get_stations()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue