Simple HTTP client like requests
Project description
📄 محتوى ملف README.md
reqlib
مكتبة Python خفيفة للتعامل مع HTTP و HTML و JSON، تدعم جميع أنواع الطلبات، رفع الملفات، تحليل الردود، واستخراج البيانات من الصفحات بسهولة.
🚀 التثبيت
pip install request
📡 الطلبات الأساسية from request import get, post, put, delete, head, options, patch
res = get("https://httpbin.org/get", params={"q": "test"}) print(res.status) print(res.text)
📦 رفع ملفات res = post("https://httpbin.org/post", files={"file": "test.txt"}) print(res.json())
🍪 الكوكيز والهيدر res = get("https://httpbin.org/cookies", cookies={"session": "abc123"}) print(res.cookies)
🔁 إعادة التوجيه res = get("https://httpbin.org/redirect/2") print(res.redirect_chain)
🧠 تحليل الرد print(res.ok) # هل الرد ناجح؟ print(res.status) # كود الحالة print(res.headers) # الهيدر print(res.cookies_dict) # كل الكوكيز من التاريخ print(res.url_parts) # تفكيك الرابط print(res.query_params) # باراميترات الرابط
🧬 JSON و HTML print(res.is_json) # هل الرد JSON؟ print(res.json()) # فك JSON print(res.html) # استخراج الحقول من أول form print(res.title) # عنوان الصفحة print(res.links) # كل الروابط print(res.assets) # الصور والسكربتات والستايلات print(res.meta) # عناصر meta
🔍 استخراج عناصر HTML استخراج قيمة attribute من أول عنصر: res.search_attr("input", "data-token")
استخراج عناصر متعددة: res.gethtml("input", "value") res.gethtml("input", ["name", "value", "data-token"]) res.gethtml(["input", "textarea"], ["name", "value"])
النتيجة: { "name": ["email", "bio"], "value": ["mhmd@example.com"], "data-token": ["abc123"] }
🧪 تحليل السكربتات print(res.js) # متغيرات JavaScript print(res.jsonhtml) # كائنات JSON داخل HTML print(res.get_script_vars())# نفس js
🔐 التعامل مع البروكسي res = get("http://httpbin.org/ip", proxies={ "http": "http://127.0.0.1:8080", "https": "http://127.0.0.1:8080" })
SOCKS5 غير مدعوم مباشرة، استخدم requests + PySocks إذا احتجت ذلك.
🧵 تحليل النموذج print(res.form_fields) # كل الحقول من أول form print(res.get_hidden_inputs)# كل الحقول المخفية
🧠 أدوات ذكية إضافية res.is_redirect # هل الرد إعادة توجيه؟ res.headers_lower # الهيدر بدون حساسية حروف res.get_cookie("session") # جلب كوكي res.get_header("Content-Type") # جلب هيدر res.json_path("data.user.email") # استخراج من JSON باستخدام dot notation res.find_tag("input", name="csrf_token") # أول عنصر يطابق
🌀 دعم أوامر curl res = curl("curl -X POST https://httpbin.org/post -d 'name=mhmd'") print(res.json())
📚 الترخيص MIT License
✨ المؤلف mhmd — مكتبة مصممة لتكون واضحة، قوية، وسهلة الاستخدام للمبرمجين المحترفين.
🤔 لماذا تستخدم reqlib بدلًا من requests؟ | | reqlib | requests | | curl | | | | | | | | | | | | | | | | multipart | | | | | | | | | | | | | | | | **kwargs | | | | | | |
✨ متى تستخدم reqlib؟
- إذا كنت تبني أدوات scraping أو تحليل صفحات HTML.
- إذا كنت تريد مكتبة خفيفة وسهلة الفهم بدون تعقيد.
- إذا كنت تفضل واجهة واضحة وصريحة بدون **kwargs.
- إذا كنت تحب التحكم الكامل في كل تفاصيل الطلب والرد.
- إذا كنت تحب كتابة أدوات مخصصة فوق مكتبة قابلة للتوسعة.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reqlib-1.2.3.tar.gz.
File metadata
- Download URL: reqlib-1.2.3.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d7d32d19ebb98bb62d23b70c62843e045e0570237e172894452a82d445ca835
|
|
| MD5 |
c68f5215f23326dbebe2204880280e8f
|
|
| BLAKE2b-256 |
9d11a0ae161a94da597998de6af670f2d5d72f78fec638fb4ce2e6c3c6d73054
|
File details
Details for the file reqlib-1.2.3-py3-none-any.whl.
File metadata
- Download URL: reqlib-1.2.3-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61d806aa1424603d4305c2657253932384265cb351b75cbc075e2f945c86beb1
|
|
| MD5 |
f40119875236e8fde0b9768e39c7d9e2
|
|
| BLAKE2b-256 |
6428442d7b9bad82343b8d3a1e781ba8444ca918bdb0a25a70fbb521f0a4ee6b
|