DEV Community

Cover image for Faster Than Requests
Juan Carlos
Juan Carlos

Posted on

Faster Than Requests

Faster Than Requests

Library Speed Files LOC Dependencies Developers
PyWGET 152.39 1 338 Wget >17
Requests 15.58 >20 2558 >7 (Depends on Urllib3) >527
Requests (pre-Cached) 5.50 >20 2558 >7 (Depends on Urllib3) >527
Urllib 4.00 ??? 1200 0 (std lib) ???
Urllib3 3.55 >40 5242 0 (No SSL), >5 (SSL) >188
PyCurl 0.75 >15 5932 Curl, LibCurl >50
PyCurl (no SSL) 0.68 >15 5932 Curl, LibCurl >50
Faster_than_requests 0.45 1 75 0 1

faster_than_requests new Version release!,
uploaded to PyPI, PIP installable,
we added new Documentation, Examples, Dockerfile, test, Proxy, FAQ, CoC, Debug, Bug Fixes, JSON helpers, Environment Variables awareness, +200 Commits, and a lot more to come!.

faster_than_requests its an alternative to the requests and HTTPS Clients on Python 3,
15 times faster than Requests, 2 times faster than PyCurl,
0 dependencies, 1 file, ~100 Lines of code.

The API is simple, instead of having a pair of functions with a lot of arguments that you should provide to make it work,
we have tiny functions with very few arguments that do one thing and do it as fast as possible.

Has extra functions requested by people and oriented towards
Data Science, Big Data, Open Data, Web Scrapping, working with HTTP REST JSON APIs.

  • We have a Docker to test drive it without installing anything.

New Documentation has all functions with detailed arguments and returns with types.

Requests depends on Urllib3

Requests now depends on Urllib3, making the total of Lines of Code >8.000.

8.000 Lines of Code to download a Cat Meme.

faster_than_requests replaces 8.000 LoC with ~100 LoC :)

We also have no Dependencies, nor Fundraising.

Hello World

import faster_than_requests as req

print(req.gets("http://example.org/get"))                     # GET
print(req.posts("http://example.org/post", "Some Data Here")) # POST
Enter fullscreen mode Exit fullscreen mode

Get it while its hot

Please Star faster_than_requests on GitHub!, awesome stuff incoming...

Top comments (10)

Collapse
 
datamance profile image
Rico Rodriguez • Edited

Don't get me wrong - I love Nim - but you're false advertising.

github.com/juancarlospaco/faster-t...

import httpclient, json, tables, nimpy, strutils

from os import sleep
from ospaths import getEnv
from random import randomize, rand
Enter fullscreen mode Exit fullscreen mode

That's a hell of a lot more than 0 dependencies and certainly more than 100 LoC (though LoC is an absurd metric to judge a library by).

It's an interesting concept, and you should certainly keep developing it, but you'd do well to lose the hubris considering that you're leaning on the extremely hard work of many engineers. My 2¢.

Collapse
 
juancarlospaco profile image
Juan Carlos

Hey there, thanks for the help confirming it, those are in fact imports.

Collapse
 
datachaz profile image
Charly Wargnier

Hi, great stuff!

I'd like to check the 1st status code in a redirect chain - with request you can do:
df['code'] = df.url.apply(lambda url: requests.get(url, allow_redirects=False).status_code)

How can you do that in faster-than-request?

Thanks,
Charly

Collapse
 
juancarlospaco profile image
Juan Carlos
response["status"]

Responses are just a vanilla simple dict.
:)

Collapse
 
kcespedes profile image
kcespedes

Hi, im new to programming, im tryying to use your faster_than_requests library but cannot get the status code of the requests made.

import faster_than_requests as requests

Exp: response = requests.post(url, "data", http_headers)

I know how to access the response status code with the requests library, but how is it done with yours?

Collapse
 
datachaz profile image
Charly Wargnier

Thanks Juan, although I can't seem to make it work.

Would you mind showing me the full Python syntax on a simple URL please?

Thanks!

Collapse
 
tamas profile image
Tamás Szelei

Looks like a very interesting project, though I must say I find the a name a bit unnecessarily hostile (and LOC a strange metric)

Some questions: How do you pass headers when making requests? Is there connection pooling? How does it perform when making many large file requests against the same host? Do you have the source code for your benchmarks?

Collapse
 
juancarlospaco profile image
Juan Carlos

The name was chosen by people, and is also part of other libs family with same name.

Collapse
 
burdier profile image
Burdier

Nice

Collapse
 
nightingale131 profile image
Nightingale131

Hi, I encounter a problem during pip install - my system freezez completly while trying to creata a wheel(?). Is there any fix for it?