Skip to content

Commit 32de8fa

Browse files
committed
example
1 parent 15948c0 commit 32de8fa

File tree

5 files changed

+72
-21
lines changed

5 files changed

+72
-21
lines changed

readme.md

+51-7
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,20 @@ def run_test():
6464
# "url": "https://httpbin.rs/get"
6565
# }
6666

67-
get_request_result = scrappey.request({
68-
"cmd": "request.get",
67+
get_request_result = scrappey.get({
6968
'session': session['session'],
7069
'url': 'https://httpbin.rs/get',
7170
})
7271
print('GET Request Result:', get_request_result)
7372

74-
post_request_result = scrappey.request({
75-
"cmd": "request.post",
73+
post_request_result = scrappey.post({
7674
"url": "https://httpbin.rs/post",
7775
"postData": "test=test&test2=test2"
7876
})
7977
print('POST Request Result:', post_request_result)
8078

8179
# JSON request example
82-
post_request_result_json = scrappey.request({
83-
"cmd": "request.post",
80+
post_request_result_json = scrappey.post({
8481
"url": "https://backend.scrappey.com/api/auth/login",
8582
"postData": "{\"email\":\"email\",\"password\":\"password\"}",
8683
"customHeaders": {
@@ -96,10 +93,57 @@ def run_test():
9693

9794
run_test()
9895

99-
```
10096

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

100+
Here are some other examples from the builder (https://app.scrappey.com/#/builder).
101+
102+
```json
103+
{
104+
"cmd": "request.get",
105+
"url": "https://httpbin.rs/get",
106+
"customHeaders": {
107+
"auth": "test"
108+
},
109+
"cookiejar": [
110+
{
111+
"key": "cookiekey",
112+
"value": "cookievalue",
113+
"domain": "httpbin.rs",
114+
"path": "/"
115+
}
116+
],
117+
"session": "86908d12-b225-446c-bb16-dc5c283e1d59",
118+
"autoparse": true,
119+
"properties": "parse using ai, product name",
120+
"proxy": "http://proxystring"
121+
}
122+
123+
{
124+
"cmd": "request.post",
125+
"url": "https://httpbin.rs/get",
126+
"postData": "{\"happy\":\"true}",
127+
"customHeaders": {
128+
"content-type": "application/json",
129+
"auth": "test"
130+
},
131+
"cookiejar": [
132+
{
133+
"key": "cookiekey",
134+
"value": "cookievalue",
135+
"domain": "httpbin.rs",
136+
"path": "/"
137+
}
138+
],
139+
"session": "86908d12-b225-446c-bb16-dc5c283e1d59",
140+
"autoparse": true,
141+
"properties": "parse using ai, product name",
142+
"proxy": "http://proxystring"
143+
}
144+
```
145+
146+
103147
## License
104148

105149
This project is licensed under the MIT License.

scrappeycom.egg-info/PKG-INFO

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: scrappeycom
3-
Version: 0.3.7
3+
Version: 0.3.8
44
Summary: An API wrapper for Scrappey.com written in Python (cloudflare bypass & solver)
55
Home-page: https://github.com/pim97/scrappey-wrapper-python
66
Download-URL: https://github.com/pim97/scrappey-wrapper-python/releases/tag/v_03
@@ -85,23 +85,20 @@ def run_test():
8585
# "url": "https://httpbin.rs/get"
8686
# }
8787

88-
get_request_result = scrappey.request({
89-
"cmd": "request.get",
88+
get_request_result = scrappey.get({
9089
'session': session['session'],
9190
'url': 'https://httpbin.rs/get',
9291
})
9392
print('GET Request Result:', get_request_result)
9493

95-
post_request_result = scrappey.request({
96-
"cmd": "request.post",
94+
post_request_result = scrappey.post({
9795
"url": "https://httpbin.rs/post",
9896
"postData": "test=test&test2=test2"
9997
})
10098
print('POST Request Result:', post_request_result)
10199

102100
# JSON request example
103-
post_request_result_json = scrappey.request({
104-
"cmd": "request.post",
101+
post_request_result_json = scrappey.post({
105102
"url": "https://backend.scrappey.com/api/auth/login",
106103
"postData": "{\"email\":\"email\",\"password\":\"password\"}",
107104
"customHeaders": {
@@ -117,6 +114,7 @@ def run_test():
117114

118115
run_test()
119116

117+
120118
```
121119

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

scrappeycom/scrappey.py

+12
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ def destroy_session(self, session):
3333
raise ValueError('session parameter is required.')
3434
return self.send_request(endpoint='sessions.destroy', data={'session': session})
3535

36+
def post(self,data):
37+
if data is None:
38+
raise ValueError('data parameter is required.')
39+
40+
return self.send_request(endpoint='request.post', data=data)
41+
42+
def get(self, data):
43+
if data is None:
44+
raise ValueError('data parameter is required.')
45+
46+
return self.send_request(endpoint='request.get', data=data)
47+
3648
def request(self, data):
3749
if data is None:
3850
raise ValueError('data parameter is required.')

scrappeycom/test.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,20 @@ def run_test():
2121
# "url": "https://httpbin.rs/get"
2222
# }
2323

24-
get_request_result = scrappey.request({
25-
"cmd": "request.get",
24+
get_request_result = scrappey.get({
2625
'session': session['session'],
2726
'url': 'https://httpbin.rs/get',
2827
})
2928
print('GET Request Result:', get_request_result)
3029

31-
post_request_result = scrappey.request({
32-
"cmd": "request.post",
30+
post_request_result = scrappey.post({
3331
"url": "https://httpbin.rs/post",
3432
"postData": "test=test&test2=test2"
3533
})
3634
print('POST Request Result:', post_request_result)
3735

3836
# JSON request example
39-
post_request_result_json = scrappey.request({
40-
"cmd": "request.post",
37+
post_request_result_json = scrappey.post({
4138
"url": "https://backend.scrappey.com/api/auth/login",
4239
"postData": "{\"email\":\"email\",\"password\":\"password\"}",
4340
"customHeaders": {

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
setup(
77
name = 'scrappeycom', # How you named your package folder (MyLib)
88
packages = ['scrappeycom'], # Chose the same as "name"
9-
version = '0.3.7', # Start with a small number and increase it with every change you make
9+
version = '0.3.8', # Start with a small number and increase it with every change you make
1010
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
1111
description = 'An API wrapper for Scrappey.com written in Python (cloudflare bypass & solver)', # Give a short description about your library
1212
author = 'dormic97', # Type in your name

0 commit comments

Comments
 (0)