> Every page of the ganymede website is listed in https://eugo.io/docs/ganymede/llms.txt.

# HTTPFS

> HTTPFS: Work with data via http. A Python demo notebook from ganymede.

Web page: https://eugo.io/docs/ganymede/demo_notebooks/data_storage/filesystems/fsspec/httpfs/
Notebook: https://eugo.io/docs/ganymede/demo_notebooks/data_storage/filesystems/fsspec/httpfs/httpfs.ipynb (source: https://github.com/eugo-inc/ganymede/blob/main/demo_notebooks/data_storage/filesystems/fsspec/httpfs.ipynb)

Description:
- Work with data via http

Resources:
- [Source Code] https://filesystem-spec.readthedocs.io/en/stable/_modules/fsspec/implementations/http.html

## Example 1

Fetch data synchronously (slow!)

```python
from fsspec import filesystem

fs = filesystem("http")

url1, url2, url3 = "http://google.com", "http://bing.com", "http://eugo.io"
out = fs.cat([url1, url2, url3])  # fetches data concurrently
```

## Example 2

Fetch data asynchronously (faster!)

```python
from fsspec import filesystem
import asyncio

fs = filesystem("http")

url1, url2, url3 = "http://google.com", "http://bing.com", "https://eugo.io"

async def work_coroutine():
    fs = filesystem("http", asynchronous=True)
    session = await fs.set_session()  # creates client
    out = await fs._cat([url1, url2, url3])  # fetches data concurrently
    await session.close()  # explicit destructor

asyncio.run(work_coroutine())
```

## Example 3

Download remote data asynchronously

```python
from fsspec import filesystem
from pathlib import Path
import asyncio

tmp = "/tmp/ganymede_demo"
Path(tmp).mkdir(parents=True, exist_ok=True)

url = "https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv"

async def download_csv():
    fs = filesystem("http", asynchronous=True)
    session = await fs.set_session()
    out = await fs._get(url, f"{tmp}/titanic.csv")
    await session.close()

asyncio.run(download_csv())
```
