Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Implement JSON POST support in FlareSolverr via WebDriver#1530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Dev-Time wants to merge3 commits intoFlareSolverr:master
base:master
Choose a base branch
Loading
fromDev-Time:feat/json-post-flaresolverr

Conversation

Dev-Time
Copy link

This commit introduces functionality to send POST requests with an 'application/json' content type using a Selenium WebDriver.

The core logic involves:

  1. Serializing a Python dictionary to a JSON string.
  2. Escaping single quotes in the JSON string to allow safe embedding into a JavaScript single-quoted string literal.
  3. Dynamically generating an HTML5 document with embedded JavaScript.
  4. The JavaScript uses thefetch API to make the POST request with the correct 'Content-Type': 'application/json' header and the JSON payload.
  5. The HTML page (and thus the script) is loaded into the WebDriver using a data URI.
  6. Status messages (success/error) are displayed in adiv on the generated page and also logged to the browser console.
  7. The function waits for the operation to complete and returns the status message from the page.

A demonstration example usinghttps://httpbin.org/post is included to showcase the functionality, including handling of successful requests, network errors, and HTTP error responses.

This approach is designed for scenarios where direct Python HTTP requests might be insufficient due to browser-specific behaviors or JavaScript dependencies on target sites.

google-labs-julesbotand others added3 commitsJune 23, 2025 22:13
This commit introduces functionality to send POST requests withan 'application/json' content type using a Selenium WebDriver.The core logic involves:1.  Serializing a Python dictionary to a JSON string.2.  Escaping single quotes in the JSON string to allow safe embedding    into a JavaScript single-quoted string literal.3.  Dynamically generating an HTML5 document with embedded JavaScript.4.  The JavaScript uses the `fetch` API to make the POST request with    the correct 'Content-Type': 'application/json' header and the    JSON payload.5.  The HTML page (and thus the script) is loaded into the WebDriver    using a data URI.6.  Status messages (success/error) are displayed in a `div` on the    generated page and also logged to the browser console.7.  The function waits for the operation to complete and returns    the status message from the page.A demonstration example using `https://httpbin.org/post` is includedto showcase the functionality, including handling of successful requests,network errors, and HTTP error responses.This approach is designed for scenarios where direct Python HTTP requestsmight be insufficient due to browser-specific behaviors or JavaScriptdependencies on target sites.
…pe` validation. Remove obsolete `request.postJSON` logic and integrate `selenium_fetch`. Update `requirements.txt` with `selenium_fetch` dependency and enhance DTOs to support `contentType` and `response` fields.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@Dev-Time

[8]ページ先頭

©2009-2025 Movatter.jp