A class to make HTTP REST requests
Project description
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/
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file fgslpyrest-1.1.2.tar.gz
.
File metadata
- Download URL: fgslpyrest-1.1.2.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using 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.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd631ea9d8e6b41e0630fbd6774c8dc761e412f74313d26e4de238b4f439edc7 |
|
MD5 | 8e96ed1df15879a6eabe20ddcf317bc7 |
|
BLAKE2b-256 | 24a8d85147527ba7750b1fd6bed05b9fe4bdb20d2efa60e16932a774ad4325f7 |