Created
December 16, 2017 20:12
-
-
Save sachaarbonel/7ee2a224276362a6199d1d4135afe6ce to your computer and use it in GitHub Desktop.
Simulating ajax request with python using requests lib (https://stackoverflow.com/questions/22183899/simulating-ajax-request-with-python-using-requests-lib)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from requests import Session | |
session = Session() | |
# HEAD requests ask for *just* the headers, which is all you need to grab the | |
# session cookie | |
session.head('http://sportsbeta.ladbrokes.com/football') | |
response = session.post( | |
url='http://sportsbeta.ladbrokes.com/view/EventDetailPageComponentController', | |
data={ | |
'N': '4294966750', | |
'form-trigger': 'moreId', | |
'moreId': '156#327', | |
'pageType': 'EventClass' | |
}, | |
headers={ | |
'Referer': 'http://sportsbeta.ladbrokes.com/football' | |
} | |
) | |
print response.text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment