Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what am I doing wrong ? #89

Closed
y-mironov opened this issue Aug 15, 2020 · 3 comments
Closed

what am I doing wrong ? #89

y-mironov opened this issue Aug 15, 2020 · 3 comments
Labels
Git Clone & Compile Recommended Git Clone & Compile Recommended question Further information is requested

Comments

@y-mironov
Copy link

y-mironov commented Aug 15, 2020

$ virtualenv -p python3.8 venv

Running virtualenv with interpreter /usr/bin/python3.8
Using base prefix '/usr'
/usr/lib/python3/dist-packages/virtualenv.py:1086: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
New python executable in /home/y_mironov/venv/bin/python3.8
Also creating executable in /home/y_mironov/venv/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.

$ source venv/bin/activate

$ pip install --no-binary :all: faster_than_requests 
Collecting faster_than_requests
  Using cached faster_than_requests-1.0.zip (2.1 MB)
Skipping wheel build for faster-than-requests, due to binaries being disabled for it.
Installing collected packages: faster-than-requests
    Running setup.py install for faster-than-requests ... done
Successfully installed faster-than-requests-1.0

$ python
Python 3.8.0 (default, Oct 28 2019, 16:14:01) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import faster_than_requests as ftr
>>> 
>>> ftr.get('http://httpbin.org/get')
{'version': '1.1', 'headers': '{"server": ["gunicorn/19.9.0"], "content-length": ["269"], "access-control-allow-credentials": ["true"], "content-type": ["application/json"], "date": ["Sat, 15 Aug 2020 15:16:24 GMT"], "access-control-allow-origin": ["*"], "connection": ["keep-alive"]}', 'status': '200 OK', 'content-type': 'application/json', 'content-length': '269', 'body': '{\n  "args": {}, \n  "headers": {\n    "Content-Length": "0", \n    "Host": "httpbin.org", \n    "User-Agent": "Nim httpclient/1.2.0", \n    "X-Amzn-Trace-Id": "Root=1-5f37fc47-7574714cc846fa6c560ff4d8"\n  }, \n  "origin": "178.218.32.50", \n  "url": "http://httpbin.org/get"\n}\n'}

>>> ftr.get('http://httpbin.org/get', timeout=99)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: get() takes exactly 1 arguments (2 given)

>>> ftr.post('http://httpbin.org/post', body='')
{'version': '1.1', 'headers': '{"server": ["gunicorn/19.9.0"], "content-length": ["333"], "access-control-allow-credentials": ["true"], "content-type": ["application/json"], "date": ["Sat, 15 Aug 2020 15:16:54 GMT"], "access-control-allow-origin": ["*"], "connection": ["keep-alive"]}', 'status': '200 OK', 'content-type': 'application/json', 'content-length': '333', 'body': '{\n  "args": {}, \n  "data": "", \n  "files": {}, \n  "form": {}, \n  "headers": {\n    "Content-Length": "0", \n    "Host": "httpbin.org", \n    "User-Agent": "Nim httpclient/1.2.0", \n    "X-Amzn-Trace-Id": "Root=1-5f37fc65-92ecf29822b017ac8439db66"\n  }, \n  "json": null, \n  "origin": "178.218.32.50", \n  "url": "http://httpbin.org/post"\n}\n'}

>>> ftr.post('http://httpbin.org/post', body='', http_headers=[("DNT", "1")])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: post() got multiple values for argument body
>>> 
>>> ftr.urlparse("https://nim-lang.org")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'faster_than_requests' has no attribute 'urlparse'
>>> 

I can't figure out why the examples from the documentation don't work?

@juancarlospaco
Copy link
Owner

juancarlospaco commented Aug 15, 2020

You are doing it right, code is wrong.

timeout is milliseconds precision, so maybe multiply by 1000.

PyPI package is the last version, code on Git is the master not yet released not yet uploaded to PyPI.
Versioned package may not have all new features mentioned on master.

You can just Git clone and compile, then you get the code on master, with the API from master.
Check the GitHub Actions they build from zero on each push with very basic commands.

PyPI do not provide a Rolling Release capability, sorry.
:)

@juancarlospaco juancarlospaco added Git Clone & Compile Recommended Git Clone & Compile Recommended question Further information is requested labels Aug 15, 2020
@y-mironov
Copy link
Author

Thanks. It will be too difficult for me to use it in production, IMHO.

@juancarlospaco
Copy link
Owner

juancarlospaco commented Aug 30, 2020

Fixed, from now on, all sources and Python package will be on /dist/ of the repo on each commit.

https://github.com/juancarlospaco/faster-than-requests/actions/runs/230790703

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Git Clone & Compile Recommended Git Clone & Compile Recommended question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants