DEV Community

Cover image for Faster Than Requests

Faster Than Requests

Juan Carlos on May 20, 2019

Library Speed Files LOC Dependencies Developers PyWGET 152.39 1 338 Wget >17 Requests 15.58 >20 2558 >7 (Depends on Urllib3) &g...
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?