|
1 | 1 | Metadata-Version: 2.1
|
2 | 2 | Name: scrappeycom
|
3 |
| -Version: 0.3.4 |
| 3 | +Version: 0.3.6 |
4 | 4 | Summary: An API wrapper for Scrappey.com written in Python (cloudflare bypass & solver)
|
5 | 5 | Home-page: https://github.com/pim97/scrappey-wrapper-python
|
6 | 6 | Download-URL: https://github.com/pim97/scrappey-wrapper-python/releases/tag/v_03
|
@@ -62,28 +62,61 @@ scrappey_instance = scrappey.Scrappey(api_key)
|
62 | 62 | Here's an example of how to use Scrappey. 🚀
|
63 | 63 |
|
64 | 64 | ```python
|
65 |
| -from scrappeycom.scrappey import Scrappey |
| 65 | +from scrappey import Scrappey |
| 66 | +import uuid |
66 | 67 |
|
67 | 68 | scrappey = Scrappey('API_KEY')
|
68 | 69 |
|
69 | 70 | def run_test():
|
70 | 71 | try:
|
71 |
| - session = scrappey.create_session() |
72 |
| - print(session) |
73 |
| - |
74 |
| - get_request_result = scrappey.get_request('https://httpbin.rs/get', session['session']) |
| 72 | + sessionData = { |
| 73 | + 'session': str(uuid.uuid4()), #uuid is also optional, otherwise default uuid will be used |
| 74 | + #'proxy': 'http://username:password@ip:port' #proxy is optional, otherwise default proxy will be used |
| 75 | + } |
| 76 | + session = scrappey.create_session(sessionData) |
| 77 | + print('Session created:', session['session']) |
| 78 | + |
| 79 | + # View all the options here with the request builder |
| 80 | + # https://app.scrappey.com/#/builder |
| 81 | + # Just copy paste it below, example |
| 82 | + # |
| 83 | + # { |
| 84 | + # "cmd": "request.get", |
| 85 | + # "url": "https://httpbin.rs/get" |
| 86 | + # } |
| 87 | + |
| 88 | + get_request_result = scrappey.request({ |
| 89 | + "cmd": "request.get", |
| 90 | + 'session': session['session'], |
| 91 | + 'url': 'https://httpbin.rs/get', |
| 92 | + }) |
75 | 93 | print('GET Request Result:', get_request_result)
|
76 | 94 |
|
77 |
| - post_data = {'username': 'user123', 'password': 'pass456'} |
78 |
| - post_request_result = scrappey.post_request('https://httpbin.rs/post', post_data, session['session']) |
| 95 | + post_request_result = scrappey.request({ |
| 96 | + "cmd": "request.post", |
| 97 | + "url": "https://httpbin.rs/post", |
| 98 | + "postData": "test=test&test2=test2" |
| 99 | + }) |
79 | 100 | print('POST Request Result:', post_request_result)
|
80 | 101 |
|
81 |
| - scrappey.destroy_session(session['session']) |
82 |
| - print('Session destroyed.') |
| 102 | + # JSON request example |
| 103 | + post_request_result_json = scrappey.request({ |
| 104 | + "cmd": "request.post", |
| 105 | + "url": "https://backend.scrappey.com/api/auth/login", |
| 106 | + "postData": "{\"email\":\"email\",\"password\":\"password\"}", |
| 107 | + "customHeaders": { |
| 108 | + "content-type": "application/json" |
| 109 | + } |
| 110 | + }) |
| 111 | + print('POST Request Result:', post_request_result_json) |
| 112 | + |
| 113 | + sessionDestroyed = scrappey.destroy_session(sessionData) |
| 114 | + print('Session destroyed:', sessionDestroyed) |
83 | 115 | except Exception as error:
|
84 | 116 | print(error)
|
85 | 117 |
|
86 | 118 | run_test()
|
| 119 | + |
87 | 120 | ```
|
88 | 121 |
|
89 | 122 | For more information, please visit the [official Scrappey documentation](https://wiki.scrappey.com/getting-started). 📚
|
|
0 commit comments