fgslpyrest
Python component to make HTTP RESTful requests.
How to install
pip install fgslpyrest
Using the component
Making a HTTP GET request in the terminal
The sequence of commands below make a HTTP GET request and check if the response has the word "German". The response, in this case, is HTML. The last parameter enables verbose output.
$ python
>>> from fgslpyrest.http.Rest import Rest
>>> rest = Rest()
>>> response = rest.doGet([],"https://time.is/pt_br/UTC",200,True)
>>> print(response.find("German"))
The next sequence of commands make a HTTP request which returns a JSON object.
$ python
>>> import json
>>> from fgslpyrest.http.Rest import Rest
>>> rest = Rest()
>>> response = rest.doGet([],"https://reqres.in/api/users/2",200)
>>> user = json.loads(response)
>>> print(user["data"]["email"])
For developers
- PKG-INFO describes the package in a summarized way.
- MANIFEST.in defines which files will be included into the package.
- pyproject.toml defines the general packaging information.
More information at https://packaging.python.org/en/latest/tutorials/packaging-projects/
Running the unit tests
python -m unittest tests/resttest.py
Building the package
python -m build --sdist .
Requires build module. You can install it using pip install build.
Upload the package to PyPI
twine upload dist/*
Troubleshooting
If you try to install and receive a error message with this fragments:
filename has 'fgslpyrest', but metadata has 'unknown'
ERROR: No matching distribution found for fgslpyrest
Then run this command:
pip3 install --upgrade pip
And try to install again.
Release files for fgslpyrest 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fgslpyrest-1.1.3.tar.gz | 15.1 kB | Details |
Release files / fgslpyrest-1.1.3.tar.gz
| Download URL | fgslpyrest-1.1.3.tar.gz |
|---|---|
| Size | 15.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6b904e80b13ff8b540160ec0238ad9757d1c186cb45a9e1f2dfba4d46a163c7
|
|
BLAKE2b-256 checksum How to use checksums |
8e3cb96659d36eea7d1435941cf68931aa0b636e7249746789e0ee07935b9dc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.26.0 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12
|