Metadata-Version: 2.1
Name: fetchx
Version: 0.0.42
Summary: fetchx library and its two main functions "call" and "fetch" are designed to allow users to rapidly scrape/automate web applications.
Home-page: UNKNOWN
Author: Jaromir Sivic
Author-email: unknown@unknown.com
License: MIT
Keywords: fetch,fetchx,httpx,http 2
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: httpx
Requires-Dist: h2
Provides-Extra: dev
Requires-Dist: twine (>=4.0.2) ; extra == 'dev'


# uurest
Library that allows developers to easily integrate their application(s) with Unicorn Systems solutions and products using REST API.

## !!!!! DEPRECATED. DO NOT USE THIS LIBRARY !!!!!

![Usage](https://raw.githubusercontent.com/jaromirsivic/uuRest/refs/heads/main/logo.png)

## How To Use the Library
```python
from uurest import *

# fetch function behavior can be setup globally or by every "fetch" call
fetch_global_setup(raise_exception_on_error=False, timeout=120, verbose=True)

response = fetch("https://www.websitewhichdoesnotexist.net") # fetch non existing web page
# response.json = {"__error__": "Unknown response type received when calling \"https://www.websitewhichdoesnotexist.net\" ...
response = fetch("http://devserver.com/tsMetadataTransfer/get") # fetch data without authorization / without sending a token
# response.json = {"__error__": "Http/Https error code \"403\" occured. Cannot process text data ...
response = fetch("https://upload.wikimedia.org/wikipedia/commons/c/cd/Google_Logo_%281998%29.png") # fetch binary file
# response.json = {"__base64__": "iVBORw0KGgoAAAANSUhEUgAAC0AAAAMWEAYAAAAy59uuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQ ...
response = fetch("https://upload.wikimedia.org/wikipedia/commons/2/2f/Google_2015_logo.svg") # fetch svg, html, css, js,  ...
# response.json = {"__text__": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<svg xmlns=\"http://www.w3  ...

# open web browser (Chrome, Edge). On the keyboard press F12 to open "DevTools". Click on the "Network" tab in the menu
# Select the request in the list. Right click on the selected item. In the popup menu click on the "Copy" -> "Copy as fetch"
# Paste the copied command from the clipboard directly into the source code. It should look like the code below.
response = fetch("https://jsonplaceholder.typicode.com/todos/1", {
    "headers": {
        "accept": "*/*",
    },
    "referrer": "https://jsonplaceholder.typicode.com/",
    "body": null,
    "method": "GET"
})
# response.json = {"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}
```

You can play with the response using following inbuild methods
```python
from uurest import *

response = fetch("https://jsonplaceholder.typicode.com/todos/1", {
    "headers": {
        "accept": "*/*",
    },
    "referrer": "https://jsonplaceholder.typicode.com/",
    "body": null,
    "method": "GET"
})
# prints formatted json
print(response) # {"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}
print(response.json["title"])  # delectus aut autem
json_object = response.json.parse() # transforms dictionary into the object
if json_object.completed:
    print("Successfully competed")
else:
    print("Not completed")
print(str(response.http_status_code))
print(response.content_type)
response.save_json("./test.json")
response.save_raw_content("./raw_content.raw")


```

Check out: https://www.youtube.com/

