xeus icon indicating copy to clipboard operation
xeus copied to clipboard

how to get sspyrs module included

Open stonebig opened this issue 3 years ago • 1 comments

Would it be possible to get the module sspyrs working, or a replacement ? If I put it or its requirement requests-ntlm in the "environment.yml", the build fails.

... yet "requets" seems to be there

# requests works in  jupyterlite/xeus-python-demo !
import requests
from datetime import date, timedelta, datetime

today = date.today()
yesterday = today - timedelta(days=10)
country =  "germany"
endpoint = f"https://api.covid19api.com/country/{country}/status/confirmed"
params = {"from": str(yesterday), "to": str(today)}
print(params)
endpoint_via_browser = f"https://api.covid19api.com/country/germany/status/confirmed?from=2022-12-06&to=2022-12-22"

response = requests.get(endpoint, params=params).json()
total_confirmed = 0
for day in response:
    date_python = datetime.fromisoformat(day.get("Date", 0)[:-1] + '+00:00')
    print(date_python.strftime('%Y-%m-%d'), f'{day.get("Cases", 0):_.0f}')
    cases = day.get("Cases", 0)
    total_confirmed += cases

print(f"Total Confirmed Covid-19 cases in {country}: {total_confirmed:_.0f}")

image

stonebig avatar Dec 26 '22 14:12 stonebig

If I put it or its requirement requests-ntlm in the "environment.yml", the build fails.

What is the build error message when you do this?

... yet "requets" seems to be there

Indeed requests is there, but it's not the real one, it's a shameless half-working mock module that lives here https://github.com/emscripten-forge/requests-wasm-polyfill. Not all the APIs have been implemented and we could use some Python dev help there! If you see anything missing from that requests module mock we can probably add it there.

martinRenou avatar Jan 02 '23 08:01 martinRenou