Is it possible to override request payload in python? [duplicate] - python

This question already exists:
How to add/edit data in request-payload available in google chrome dev tools [duplicate]
Closed 3 years ago.
I've been looking for this answer for quite long but still with no results. I'm working with selenium and I need to override one request which is generated after the submit button has been clicked. It contains data in json format under "Request payload" in chrome dev tools. I found something like seleniumwires which provides some functionality like request.overrides but I'm not sure it is working as I want. Can anyone give me some hint where to start or which tools are approporiate to do that ?

Related

Selenium python - How to capture network traffic responses [duplicate]

This question already has answers here:
How to capture network traffic with selenium
(3 answers)
Closed 2 years ago.
The issue I seem to be having is that I cannot find any way to access the network traffic responses in firefox using selenium (Python). I know that solutions exist for the Chrome webdriver, but for my case I need to use the Firefox version. I've been trying to figure this out for like have a day and I'm pulling out my hair at this point. Is there any way to get these responses?
solution using browsermob-proxy. Not exactly what I wanted, but it does give all the requests and all the responses.

getting full content of web page (using Python-requests) [duplicate]

This question already has answers here:
Programmatic Python Browser with JavaScript
(8 answers)
Closed 4 years ago.
I am new to this subject, so my question could prove stupid.. sorry in advance.
My challenge is to do web-scraping, say for this page: link (google)
I try to web-scrape it using Python,
My problem is that once I use Python requests.get, I don't seem to get the full content of the page. I guess it is because that page has many resources, and Python does not get them all. (more than that, once I scroll my mouse up - more data is reviled on Chrome. I can see from the source code that no more data is downloaded to be shown..)
How can I get the full content of a web page? what am I missing?
thanks
requests.get will get you the page web but only what the page decides to give a robot. If you want the full page web as you see it as a human you need to trick it by changing your headers. If you need to scroll or click on buttons in order to see the whole page web, which is what I think you'll need to do, I suggest you take a look at selenium.

Django - Auto run scripts at certain time on Live Server [duplicate]

This question already has answers here:
Set up a scheduled job?
(26 answers)
Closed 5 years ago.
Newbie here. I have a lot of different functions in a Python program that downloads a bunch of data from the internet, manipulates it, and displays it to the public. I have bunch of links to different tables of data, and I figure it would be very inconvenient for people to have to wait for the data to download when they clicked the link on my website. How can I configure Django to run the scripts that download the data at say, like 6am? And save some type of cached template of the data so people could quickly view that data for the entire day, and then refresh and update the data for the next day. Your insight and guidance would be very appreciated! Thank you! and Happy holidays!
I'd suggest celery for any recurring tasks in Django. Their docs are great and already have a use with Django tutorial right in them.

Scraping Google [duplicate]

This question already has an answer here:
scrape google resultstats with python [closed]
(1 answer)
Closed 9 years ago.
I am attempting to scrape Google search results as the results I receive using the API are not as useful as the results from the main site.
I am using the python requests library to grab the search page. However I am receiving an error:
Instant is off due to connection speed. Press Enter to search.
Is there any way I can disable instant search?
thanks
Python has a search api for python already, might save you some heartache.
https://developers.google.com/appengine/docs/python/search/

Django / Python how to get the full request header? [duplicate]

This question already has answers here:
How can I get all the request headers in Django?
(10 answers)
Closed 6 years ago.
I've been looking over what I can find about this and found something about denying access to specific user-agents but couldn't find how I can actually get the full request header. I am trying to make a customized analytics app so would like access to the full headers.. any info is appreciated.
All the headers are available in request.META. See the documentation.

Categories