Skip to main content

Simple HTTP client like requests

Project description

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)
print(res.json())
print(res.html)
print(res.title)
print(res.links)
print(res.assets)
print(res.meta)

🔍 استخراج عناصر HTML

res.search_attr("input", "data-token")
res.gethtml("input", "value")
res.gethtml("input", ["name", "value", "data-token"])
res.gethtml(["input", "textarea"], ["name", "value"])

🧪 تحليل السكربتات

print(res.js)
print(res.jsonhtml)
print(res.get_script_vars())

🔐 التعامل مع البروكسي

res = get("http://httpbin.org/ip", proxies={
    "http": "http://127.0.0.1:8080",
    "https": "http://127.0.0.1:8080"
})

SOCKS5 غير مدعوم مباشرة.

🧵 تحليل النموذج

print(res.form_fields)
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")
res.find_tag("input", name="csrf_token")

🌀 دعم أوامر curl

res = curl("curl -X POST https://httpbin.org/post -d 'name=mhmd'")
print(res.json())

🤔 لماذا تستخدم reqlib بدلًا من requests؟

✅ جدول مقارنة reqlib vs requests

الميزة reqlib requests


سهولة الاستخدام ✔️ أبسط -- واجهة مباشرة ✔️ سهل لكن أضخم الحجم صغير جدًا أكبر التعامل مع HTML ✔️ مدمج ❌ يحتاج BeautifulSoup استخراج البيانات من الصفحة ✔️ جاهز ❌ غير موجود تحليل السكربتات ✔️ موجود ❌ غير موجود تحليل النماذج ✔️ تلقائي ❌ غير موجود curl ✔️ يدعم تشغيل أوامر curl ❌ لا يدعم multipart ✔️ مدعوم ✔️ مدعوم الكوكيز ✔️ سهل ✔️ قوي البروكسي ✔️ HTTP(S) فقط ✔️ يدعم SOCKS إعادة التوجيه ✔️ مع redirect_chain ✔️ مدعوم قراءة JSON ✔️ json(), json_path ✔️ json() بدون kwargs ✔️ نعم ❌ يستخدم بكثرة مرونة التخصيص ✔️ عالية ✔️ عالية المجتمع جديد كبير


✨ متى تستخدم reqlib؟

  • إذا كنت تبني أدوات scraping أو تحليل صفحات HTML.
  • إذا تريد مكتبة خفيفة وسهلة بدون تعقيد.
  • إذا تفضل واجهة واضحة وصريحة.
  • إذا تحتاج استخراج عناصر HTML بدون مكتبات خارجية.
  • إذا تبني أدوات مخصصة فوق مكتبة قابلة للتوسعة.

📚 الترخيص

MIT License

✨ المؤلف

mhmd --- مكتبة مصممة لتكون واضحة، قوية، وسهلة الاستخدام للمبرمجين المحترفين.

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

reqlib-1.2.4.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reqlib-1.2.4-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file reqlib-1.2.4.tar.gz.

File metadata

  • Download URL: reqlib-1.2.4.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for reqlib-1.2.4.tar.gz
Algorithm Hash digest
SHA256 9eccdfb656182c2af41e45c5f06fcb4276acb0e7097d097babfebb2f0bf84ce4
MD5 335932571c6cf7221abd17f44ed6b6d9
BLAKE2b-256 36cc63b60d4e3a8ddfed8023e865cce77be4e3d4cdbba72af21838bb0e7ccaf3

See more details on using hashes here.

File details

Details for the file reqlib-1.2.4-py3-none-any.whl.

File metadata

  • Download URL: reqlib-1.2.4-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

Hashes for reqlib-1.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2cb70c569e0ec9bb39174620db965c3867ff055553dd7b204b8702c710bb8202
MD5 a6d76cb70d5c0ef8812daa331b816f16
BLAKE2b-256 238d3a637923ec54c891e61ad834eda5e4b6f2330a66566e880185570f1557d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page