Skip to content

Commit

Permalink
example
Browse files Browse the repository at this point in the history
  • Loading branch information
pim97 committed Jun 22, 2023
1 parent 15948c0 commit 32de8fa
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 21 deletions.
58 changes: 51 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,20 @@ def run_test():
# "url": "https://httpbin.rs/get"
# }

get_request_result = scrappey.request({
"cmd": "request.get",
get_request_result = scrappey.get({
'session': session['session'],
'url': 'https://httpbin.rs/get',
})
print('GET Request Result:', get_request_result)

post_request_result = scrappey.request({
"cmd": "request.post",
post_request_result = scrappey.post({
"url": "https://httpbin.rs/post",
"postData": "test=test&test2=test2"
})
print('POST Request Result:', post_request_result)

# JSON request example
post_request_result_json = scrappey.request({
"cmd": "request.post",
post_request_result_json = scrappey.post({
"url": "https://backend.scrappey.com/api/auth/login",
"postData": "{\"email\":\"email\",\"password\":\"password\"}",
"customHeaders": {
Expand All @@ -96,10 +93,57 @@ def run_test():

run_test()

```

```
For more information, please visit the [official Scrappey documentation](https://wiki.scrappey.com/getting-started). 📚

Here are some other examples from the builder (https://app.scrappey.com/#/builder).

```json
{
"cmd": "request.get",
"url": "https://httpbin.rs/get",
"customHeaders": {
"auth": "test"
},
"cookiejar": [
{
"key": "cookiekey",
"value": "cookievalue",
"domain": "httpbin.rs",
"path": "/"
}
],
"session": "86908d12-b225-446c-bb16-dc5c283e1d59",
"autoparse": true,
"properties": "parse using ai, product name",
"proxy": "http://proxystring"
}

{
"cmd": "request.post",
"url": "https://httpbin.rs/get",
"postData": "{\"happy\":\"true}",
"customHeaders": {
"content-type": "application/json",
"auth": "test"
},
"cookiejar": [
{
"key": "cookiekey",
"value": "cookievalue",
"domain": "httpbin.rs",
"path": "/"
}
],
"session": "86908d12-b225-446c-bb16-dc5c283e1d59",
"autoparse": true,
"properties": "parse using ai, product name",
"proxy": "http://proxystring"
}
```


## License

This project is licensed under the MIT License.
Expand Down
12 changes: 5 additions & 7 deletions scrappeycom.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: scrappeycom
Version: 0.3.7
Version: 0.3.8
Summary: An API wrapper for Scrappey.com written in Python (cloudflare bypass & solver)
Home-page: https://github.com/pim97/scrappey-wrapper-python
Download-URL: https://github.com/pim97/scrappey-wrapper-python/releases/tag/v_03
Expand Down Expand Up @@ -85,23 +85,20 @@ def run_test():
# "url": "https://httpbin.rs/get"
# }

get_request_result = scrappey.request({
"cmd": "request.get",
get_request_result = scrappey.get({
'session': session['session'],
'url': 'https://httpbin.rs/get',
})
print('GET Request Result:', get_request_result)

post_request_result = scrappey.request({
"cmd": "request.post",
post_request_result = scrappey.post({
"url": "https://httpbin.rs/post",
"postData": "test=test&test2=test2"
})
print('POST Request Result:', post_request_result)

# JSON request example
post_request_result_json = scrappey.request({
"cmd": "request.post",
post_request_result_json = scrappey.post({
"url": "https://backend.scrappey.com/api/auth/login",
"postData": "{\"email\":\"email\",\"password\":\"password\"}",
"customHeaders": {
Expand All @@ -117,6 +114,7 @@ def run_test():

run_test()


```

For more information, please visit the [official Scrappey documentation](https://wiki.scrappey.com/getting-started). 📚
Expand Down
12 changes: 12 additions & 0 deletions scrappeycom/scrappey.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ def destroy_session(self, session):
raise ValueError('session parameter is required.')
return self.send_request(endpoint='sessions.destroy', data={'session': session})

def post(self,data):
if data is None:
raise ValueError('data parameter is required.')

return self.send_request(endpoint='request.post', data=data)

def get(self, data):
if data is None:
raise ValueError('data parameter is required.')

return self.send_request(endpoint='request.get', data=data)

def request(self, data):
if data is None:
raise ValueError('data parameter is required.')
Expand Down
9 changes: 3 additions & 6 deletions scrappeycom/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,20 @@ def run_test():
# "url": "https://httpbin.rs/get"
# }

get_request_result = scrappey.request({
"cmd": "request.get",
get_request_result = scrappey.get({
'session': session['session'],
'url': 'https://httpbin.rs/get',
})
print('GET Request Result:', get_request_result)

post_request_result = scrappey.request({
"cmd": "request.post",
post_request_result = scrappey.post({
"url": "https://httpbin.rs/post",
"postData": "test=test&test2=test2"
})
print('POST Request Result:', post_request_result)

# JSON request example
post_request_result_json = scrappey.request({
"cmd": "request.post",
post_request_result_json = scrappey.post({
"url": "https://backend.scrappey.com/api/auth/login",
"postData": "{\"email\":\"email\",\"password\":\"password\"}",
"customHeaders": {
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
setup(
name = 'scrappeycom', # How you named your package folder (MyLib)
packages = ['scrappeycom'], # Chose the same as "name"
version = '0.3.7', # Start with a small number and increase it with every change you make
version = '0.3.8', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'An API wrapper for Scrappey.com written in Python (cloudflare bypass & solver)', # Give a short description about your library
author = 'dormic97', # Type in your name
Expand Down

0 comments on commit 32de8fa

Please sign in to comment.