askpablos-api 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Fawad Ali
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,255 @@
1
+ Metadata-Version: 2.4
2
+ Name: askpablos-api
3
+ Version: 0.1.0
4
+ Summary: Professional Python client for the AskPablos proxy API service
5
+ Author-email: Fawad Ali <fawadstar6@gmail.com>
6
+ Maintainer-email: Fawad Ali <fawadstar6@gmail.com>
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/fawadss1/askpablos-api
9
+ Project-URL: Documentation, https://askpablos-api.readthedocs.io
10
+ Project-URL: Repository, https://github.com/fawadss1/askpablos-api
11
+ Project-URL: Bug Tracker, https://github.com/fawadss1/askpablos-api/issues
12
+ Keywords: proxy,api,web-scraping,browser,http-client,askpablos
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Natural Language :: English
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
25
+ Classifier: Topic :: Internet :: Proxy Servers
26
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
+ Classifier: Topic :: System :: Networking
28
+ Requires-Python: >=3.9
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: requests>=2.25.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=6.0; extra == "dev"
34
+ Requires-Dist: pytest-cov>=2.0; extra == "dev"
35
+ Requires-Dist: black>=21.0; extra == "dev"
36
+ Requires-Dist: flake8>=3.8; extra == "dev"
37
+ Requires-Dist: mypy>=0.900; extra == "dev"
38
+ Requires-Dist: pre-commit>=2.0; extra == "dev"
39
+ Provides-Extra: docs
40
+ Requires-Dist: sphinx>=4.0; extra == "docs"
41
+ Requires-Dist: sphinx-rtd-theme>=1.0; extra == "docs"
42
+ Requires-Dist: myst-parser>=0.15; extra == "docs"
43
+ Dynamic: license-file
44
+
45
+ # AskPablos API Client
46
+ [![PyPI Version](https://img.shields.io/pypi/v/askpablos-api.svg)](https://pypi.python.org/pypi/askpablos-api)
47
+ [![Supported Python Versions](https://img.shields.io/pypi/pyversions/askpablos-api.svg)](https://pypi.python.org/pypi/askpablos-api)
48
+
49
+ A simple Python client for making GET requests through the AskPablos proxy API service. This library provides a clean and easy-to-use interface for fetching web pages and APIs through the AskPablos proxy infrastructure.
50
+
51
+ ## Features
52
+
53
+ - 🔐 **Secure Authentication**: HMAC-SHA256 signature-based authentication
54
+ - 🌐 **Proxy Support**: Route requests through rotating proxies
55
+ - 🤖 **Browser Integration**: Support for JavaScript-heavy websites
56
+ - 🛡️ **Error Handling**: Comprehensive exception handling
57
+ - 📊 **Logging**: Built-in logging support for debugging
58
+ - 🎯 **Simple Interface**: GET-only requests for clean API
59
+
60
+ ## Installation
61
+
62
+ ```bash
63
+ pip install askpablos-api
64
+ ```
65
+
66
+ ## Quick Start
67
+
68
+ ```python
69
+ from askpablos_api import AskPablos
70
+
71
+ # Initialize the client
72
+ client = AskPablos(
73
+ api_key="your_api_key",
74
+ secret_key="your_secret_key"
75
+ )
76
+
77
+ # Make a simple GET request
78
+ response = client.get("https://httpbin.org/ip")
79
+ print(response)
80
+ ```
81
+
82
+ ## Authentication
83
+
84
+ The AskPablos API uses HMAC-SHA256 signature-based authentication. You only need:
85
+
86
+ 1. **API Key**: Your unique API identifier
87
+ 2. **Secret Key**: Your private key for signing requests
88
+
89
+ ```python
90
+ from askpablos_api import AskPablos
91
+
92
+ client = AskPablos(
93
+ api_key="your_api_key",
94
+ secret_key="your_secret_key"
95
+ )
96
+ ```
97
+
98
+ ## Usage Examples
99
+
100
+ ### Basic GET Requests
101
+
102
+ ```python
103
+ # Simple GET request
104
+ response = client.get("https://example.com")
105
+
106
+ # GET with query parameters
107
+ response = client.get(
108
+ "https://api.example.com/users",
109
+ params={"page": 1, "limit": 10}
110
+ )
111
+
112
+ # GET with custom headers
113
+ response = client.get(
114
+ "https://api.example.com/data",
115
+ headers={"Authorization": "Bearer token123"}
116
+ )
117
+ ```
118
+
119
+ ### Advanced Options
120
+
121
+ ```python
122
+ # Use browser automation for JavaScript-heavy sites
123
+ response = client.get(
124
+ "https://spa-website.com",
125
+ browser=True
126
+ )
127
+
128
+ # Disable proxy rotation
129
+ response = client.get(
130
+ "https://example.com",
131
+ rotate_proxy=False
132
+ )
133
+
134
+ # Custom user agent and cookies
135
+ response = client.get(
136
+ "https://example.com",
137
+ user_agent="Mozilla/5.0 (Custom Bot)",
138
+ cookies={"session": "abc123"}
139
+ )
140
+
141
+ # Custom timeout
142
+ response = client.get(
143
+ "https://slow-website.com",
144
+ timeout=60
145
+ )
146
+ ```
147
+
148
+ ### Error Handling
149
+
150
+ ```python
151
+ from askpablos_api import (
152
+ AskPablos,
153
+ AuthenticationError,
154
+ APIConnectionError,
155
+ ResponseError
156
+ )
157
+
158
+ try:
159
+ client = AskPablos(api_key="", secret_key="")
160
+ except AuthenticationError as e:
161
+ print(f"Authentication failed: {e}")
162
+
163
+ try:
164
+ response = client.get("https://example.com")
165
+ except APIConnectionError as e:
166
+ print(f"Connection failed: {e}")
167
+ except ResponseError as e:
168
+ print(f"API error {e.status_code}: {e.message}")
169
+ ```
170
+
171
+ ### Logging
172
+
173
+ ```python
174
+ from askpablos_api import configure_logging
175
+ import logging
176
+
177
+ # Enable debug logging
178
+ configure_logging(level=logging.DEBUG)
179
+
180
+ client = AskPablos(api_key="...", secret_key="...")
181
+ response = client.get("https://example.com") # This will be logged
182
+ ```
183
+
184
+ ## API Reference
185
+
186
+ ### AskPablos Class
187
+
188
+ The main interface for the API client.
189
+
190
+ #### Constructor
191
+
192
+ ```python
193
+ AskPablos(api_key: str, secret_key: str)
194
+ ```
195
+
196
+ **Parameters:**
197
+ - `api_key` (str): Your API key from the AskPablos dashboard
198
+ - `secret_key` (str): Your secret key for HMAC signing
199
+
200
+ #### Methods
201
+
202
+ ##### get()
203
+
204
+ ```python
205
+ get(url, params=None, headers=None, browser=False, rotate_proxy=True, timeout=30, **options)
206
+ ```
207
+
208
+ Send a GET request through the AskPablos proxy.
209
+
210
+ **Parameters:**
211
+ - `url` (str): Target URL to fetch
212
+ - `params` (dict, optional): URL query parameters
213
+ - `headers` (dict, optional): Custom headers
214
+ - `browser` (bool, optional): Use browser automation (default: False)
215
+ - `rotate_proxy` (bool, optional): Enable proxy rotation (default: True)
216
+ - `timeout` (int, optional): Request timeout in seconds (default: 30)
217
+ - `**options`: Additional options like user_agent, cookies, etc.
218
+
219
+ **Returns:** Dictionary containing the API response
220
+
221
+ ### Exception Classes
222
+
223
+ - `AskPablosError` - Base exception class
224
+ - `AuthenticationError` - Authentication-related errors
225
+ - `APIConnectionError` - Connection and network errors
226
+ - `ResponseError` - API response errors
227
+
228
+ ## Response Format
229
+
230
+ All successful requests return a dictionary with:
231
+
232
+ ```python
233
+ {
234
+ "status_code": 200,
235
+ "headers": {"content-type": "text/html", ...},
236
+ "content": "Response body content",
237
+ "url": "Final URL after redirects",
238
+ "proxy_used": "proxy.example.com:8080",
239
+ "time_taken": 1.23
240
+ }
241
+ ```
242
+
243
+ ## Requirements
244
+
245
+ - Python 3.9+
246
+ - requests >= 2.25.0
247
+
248
+ ## License
249
+
250
+ This project is licensed under the MIT License.
251
+
252
+ ## Support
253
+
254
+ For support and questions:
255
+ - Email: fawadstar6@gmail.com
@@ -0,0 +1,211 @@
1
+ # AskPablos API Client
2
+ [![PyPI Version](https://img.shields.io/pypi/v/askpablos-api.svg)](https://pypi.python.org/pypi/askpablos-api)
3
+ [![Supported Python Versions](https://img.shields.io/pypi/pyversions/askpablos-api.svg)](https://pypi.python.org/pypi/askpablos-api)
4
+
5
+ A simple Python client for making GET requests through the AskPablos proxy API service. This library provides a clean and easy-to-use interface for fetching web pages and APIs through the AskPablos proxy infrastructure.
6
+
7
+ ## Features
8
+
9
+ - 🔐 **Secure Authentication**: HMAC-SHA256 signature-based authentication
10
+ - 🌐 **Proxy Support**: Route requests through rotating proxies
11
+ - 🤖 **Browser Integration**: Support for JavaScript-heavy websites
12
+ - 🛡️ **Error Handling**: Comprehensive exception handling
13
+ - 📊 **Logging**: Built-in logging support for debugging
14
+ - 🎯 **Simple Interface**: GET-only requests for clean API
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ pip install askpablos-api
20
+ ```
21
+
22
+ ## Quick Start
23
+
24
+ ```python
25
+ from askpablos_api import AskPablos
26
+
27
+ # Initialize the client
28
+ client = AskPablos(
29
+ api_key="your_api_key",
30
+ secret_key="your_secret_key"
31
+ )
32
+
33
+ # Make a simple GET request
34
+ response = client.get("https://httpbin.org/ip")
35
+ print(response)
36
+ ```
37
+
38
+ ## Authentication
39
+
40
+ The AskPablos API uses HMAC-SHA256 signature-based authentication. You only need:
41
+
42
+ 1. **API Key**: Your unique API identifier
43
+ 2. **Secret Key**: Your private key for signing requests
44
+
45
+ ```python
46
+ from askpablos_api import AskPablos
47
+
48
+ client = AskPablos(
49
+ api_key="your_api_key",
50
+ secret_key="your_secret_key"
51
+ )
52
+ ```
53
+
54
+ ## Usage Examples
55
+
56
+ ### Basic GET Requests
57
+
58
+ ```python
59
+ # Simple GET request
60
+ response = client.get("https://example.com")
61
+
62
+ # GET with query parameters
63
+ response = client.get(
64
+ "https://api.example.com/users",
65
+ params={"page": 1, "limit": 10}
66
+ )
67
+
68
+ # GET with custom headers
69
+ response = client.get(
70
+ "https://api.example.com/data",
71
+ headers={"Authorization": "Bearer token123"}
72
+ )
73
+ ```
74
+
75
+ ### Advanced Options
76
+
77
+ ```python
78
+ # Use browser automation for JavaScript-heavy sites
79
+ response = client.get(
80
+ "https://spa-website.com",
81
+ browser=True
82
+ )
83
+
84
+ # Disable proxy rotation
85
+ response = client.get(
86
+ "https://example.com",
87
+ rotate_proxy=False
88
+ )
89
+
90
+ # Custom user agent and cookies
91
+ response = client.get(
92
+ "https://example.com",
93
+ user_agent="Mozilla/5.0 (Custom Bot)",
94
+ cookies={"session": "abc123"}
95
+ )
96
+
97
+ # Custom timeout
98
+ response = client.get(
99
+ "https://slow-website.com",
100
+ timeout=60
101
+ )
102
+ ```
103
+
104
+ ### Error Handling
105
+
106
+ ```python
107
+ from askpablos_api import (
108
+ AskPablos,
109
+ AuthenticationError,
110
+ APIConnectionError,
111
+ ResponseError
112
+ )
113
+
114
+ try:
115
+ client = AskPablos(api_key="", secret_key="")
116
+ except AuthenticationError as e:
117
+ print(f"Authentication failed: {e}")
118
+
119
+ try:
120
+ response = client.get("https://example.com")
121
+ except APIConnectionError as e:
122
+ print(f"Connection failed: {e}")
123
+ except ResponseError as e:
124
+ print(f"API error {e.status_code}: {e.message}")
125
+ ```
126
+
127
+ ### Logging
128
+
129
+ ```python
130
+ from askpablos_api import configure_logging
131
+ import logging
132
+
133
+ # Enable debug logging
134
+ configure_logging(level=logging.DEBUG)
135
+
136
+ client = AskPablos(api_key="...", secret_key="...")
137
+ response = client.get("https://example.com") # This will be logged
138
+ ```
139
+
140
+ ## API Reference
141
+
142
+ ### AskPablos Class
143
+
144
+ The main interface for the API client.
145
+
146
+ #### Constructor
147
+
148
+ ```python
149
+ AskPablos(api_key: str, secret_key: str)
150
+ ```
151
+
152
+ **Parameters:**
153
+ - `api_key` (str): Your API key from the AskPablos dashboard
154
+ - `secret_key` (str): Your secret key for HMAC signing
155
+
156
+ #### Methods
157
+
158
+ ##### get()
159
+
160
+ ```python
161
+ get(url, params=None, headers=None, browser=False, rotate_proxy=True, timeout=30, **options)
162
+ ```
163
+
164
+ Send a GET request through the AskPablos proxy.
165
+
166
+ **Parameters:**
167
+ - `url` (str): Target URL to fetch
168
+ - `params` (dict, optional): URL query parameters
169
+ - `headers` (dict, optional): Custom headers
170
+ - `browser` (bool, optional): Use browser automation (default: False)
171
+ - `rotate_proxy` (bool, optional): Enable proxy rotation (default: True)
172
+ - `timeout` (int, optional): Request timeout in seconds (default: 30)
173
+ - `**options`: Additional options like user_agent, cookies, etc.
174
+
175
+ **Returns:** Dictionary containing the API response
176
+
177
+ ### Exception Classes
178
+
179
+ - `AskPablosError` - Base exception class
180
+ - `AuthenticationError` - Authentication-related errors
181
+ - `APIConnectionError` - Connection and network errors
182
+ - `ResponseError` - API response errors
183
+
184
+ ## Response Format
185
+
186
+ All successful requests return a dictionary with:
187
+
188
+ ```python
189
+ {
190
+ "status_code": 200,
191
+ "headers": {"content-type": "text/html", ...},
192
+ "content": "Response body content",
193
+ "url": "Final URL after redirects",
194
+ "proxy_used": "proxy.example.com:8080",
195
+ "time_taken": 1.23
196
+ }
197
+ ```
198
+
199
+ ## Requirements
200
+
201
+ - Python 3.9+
202
+ - requests >= 2.25.0
203
+
204
+ ## License
205
+
206
+ This project is licensed under the MIT License.
207
+
208
+ ## Support
209
+
210
+ For support and questions:
211
+ - Email: fawadstar6@gmail.com
@@ -0,0 +1,28 @@
1
+ """
2
+ askpablos_api
3
+
4
+ A Python client library for interacting with the AskPablos proxy API service.
5
+ """
6
+
7
+ from .core import AskPablos
8
+ from .client import ProxyClient
9
+ from .exceptions import (
10
+ AskPablosError,
11
+ AuthenticationError,
12
+ APIConnectionError,
13
+ ResponseError
14
+ )
15
+ from .utils import configure_logging
16
+
17
+ __version__ = "0.1.0"
18
+
19
+ # Set up default exports
20
+ __all__ = [
21
+ "AskPablos",
22
+ "ProxyClient",
23
+ "AskPablosError",
24
+ "AuthenticationError",
25
+ "APIConnectionError",
26
+ "ResponseError",
27
+ "configure_logging",
28
+ ]