-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] proxy_spider #10923 #18927
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
components/proxy_spider/actions/list-proxies/list-proxies.mjs
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| import app from "../../proxy_spider.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "proxy_spider-list-proxies", | ||
| name: "List Proxies", | ||
| description: "List proxies from Proxy Spider. [See the documentation](https://proxy-spider.com/docs/api/public-proxies)", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| openWorldHint: true, | ||
| destructiveHint: false, | ||
| readOnlyHint: true, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| limit: { | ||
| propDefinition: [ | ||
| app, | ||
| "limit", | ||
| ], | ||
| }, | ||
| countryCode: { | ||
| propDefinition: [ | ||
| app, | ||
| "countryCode", | ||
| ], | ||
| }, | ||
| responseTime: { | ||
| propDefinition: [ | ||
| app, | ||
| "responseTime", | ||
| ], | ||
| }, | ||
| protocols: { | ||
| propDefinition: [ | ||
| app, | ||
| "protocols", | ||
| ], | ||
| }, | ||
| type: { | ||
| propDefinition: [ | ||
| app, | ||
| "type", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.listProxies({ | ||
| $, | ||
| params: { | ||
| limit: this.limit, | ||
| country_code: this.countryCode?.join(","), | ||
| response_time: this.responseTime?.join(","), | ||
| protocols: this.protocols?.join(","), | ||
| type: this.type?.join(","), | ||
| }, | ||
| }); | ||
| $.export("$summary", "Successfully sent the request. Retrieved " + response.data.proxies.length + " proxies"); | ||
| return response; | ||
| }, | ||
| }; |
24 changes: 24 additions & 0 deletions
24
components/proxy_spider/actions/ping-server/ping-server.mjs
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import app from "../../proxy_spider.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "proxy_spider-ping-server", | ||
| name: "Ping Server", | ||
| description: "Ping Proxy Spider. [See the documentation](https://proxy-spider.com/docs/api/public-proxies)", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| openWorldHint: true, | ||
| destructiveHint: false, | ||
| readOnlyHint: true, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.pingServer({ | ||
| $, | ||
| }); | ||
| $.export("$summary", "Successfully sent the request. Status: " + response.status); | ||
| return response; | ||
| }, | ||
| }; |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| export default { | ||
| TIME_OPTIONS: [ | ||
| "slow", | ||
| "medium", | ||
| "fast", | ||
| ], | ||
| PROTOCOLS: [ | ||
| "http", | ||
| "https", | ||
| "socks4", | ||
| "socks5", | ||
| ], | ||
| TYPES: [ | ||
| "anonymous", | ||
| "elite", | ||
| "transparent", | ||
| ], | ||
| }; |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/proxy_spider", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Proxy Spider Components", | ||
| "main": "proxy_spider.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.1.0" | ||
| } | ||
| } | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,77 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
| import constants from "./common/constants.mjs"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "proxy_spider", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| limit: { | ||
| type: "integer", | ||
| label: "Limit", | ||
| description: "The number of proxies to retrieve, between 1 and 1000", | ||
| optional: true, | ||
| }, | ||
| countryCode: { | ||
| type: "string[]", | ||
| label: "Country Code", | ||
| description: "Add this to retrieve only proxies at this location, i.e.: `US`", | ||
| optional: true, | ||
| }, | ||
| responseTime: { | ||
| type: "string[]", | ||
| label: "Response Time", | ||
| description: "Add this to retrieve only proxies with a specific response time", | ||
| optional: true, | ||
| options: constants.TIME_OPTIONS, | ||
| }, | ||
| protocols: { | ||
| type: "string[]", | ||
| label: "Protocols", | ||
| description: "Add this to retrieve only proxies with a specific protocol", | ||
| optional: true, | ||
| options: constants.PROTOCOLS, | ||
| }, | ||
| type: { | ||
| type: "string[]", | ||
| label: "Type", | ||
| description: "Add this to retrieve only proxies with a type", | ||
| optional: true, | ||
| options: constants.TYPES, | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return "https://proxy-spider.com/api"; | ||
| }, | ||
| async _makeRequest(opts = {}) { | ||
| const { | ||
| $ = this, | ||
| path, | ||
| params, | ||
| ...otherOpts | ||
| } = opts; | ||
| return axios($, { | ||
| ...otherOpts, | ||
| url: this._baseUrl() + path, | ||
| params: { | ||
| api_key: `${this.$auth.api_key}`, | ||
| ...params, | ||
| }, | ||
| }); | ||
| }, | ||
|
|
||
| async listProxies(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/proxies.json", | ||
| ...args, | ||
| }); | ||
| }, | ||
|
|
||
| async pingServer(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/ping.json", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Add min/max validation constraints.
The description states the limit should be "between 1 and 1000", but the prop definition lacks validation to enforce this range.
Apply this diff to add the constraints:
limit: { type: "integer", label: "Limit", description: "The number of proxies to retrieve, between 1 and 1000", optional: true, + min: 1, + max: 1000, },📝 Committable suggestion
🤖 Prompt for AI Agents