pvfactors#

[1]:
import utils
from bokeh.io import output_notebook
from bokeh.plotting import show
[2]:
output_notebook()
Loading BokehJS ...

GitHub#

[3]:
gh = utils.get_github_stars('sunpower/pvfactors')
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 gh = utils.get_github_stars('sunpower/pvfactors')

File ~/work/pv-foss-engagement/pv-foss-engagement/sphinx/source/project/utils.py:83, in get_github_stars(repo)
     82 def get_github_stars(repo):
---> 83     data, N = _fetch_gh_api(repo)
     84     for i in range(2, N+1):
     85         data.extend(_fetch_gh_api(repo, i)[0])

File ~/work/pv-foss-engagement/pv-foss-engagement/sphinx/source/project/utils.py:77, in _fetch_gh_api(repo, page)
     74     N = 1
     76 if isinstance(data, dict) and data.get('status', None) != 200:
---> 77     raise Exception(data)
     79 return data, N

Exception: {'message': 'Bad credentials', 'documentation_url': 'https://docs.github.com/rest', 'status': '401'}
[4]:
p = utils.plot_github_stars_timeseries(gh)
show(p)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[4], line 1
----> 1 p = utils.plot_github_stars_timeseries(gh)
      2 show(p)

NameError: name 'gh' is not defined
[5]:
contributor_ts, _ = utils.get_github_contributor_timeseries("sunpower/pvfactors")
p = utils.plot_github_contributors_timeseries(contributor_ts)
show(p)
[6]:
contributors = utils.get_github_contributors('sunpower/pvfactors')
[7]:
mosaic = utils.make_github_contributors_mosaic(contributors)
mosaic
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[7], line 1
----> 1 mosaic = utils.make_github_contributors_mosaic(contributors)
      2 mosaic

File ~/work/pv-foss-engagement/pv-foss-engagement/sphinx/source/project/utils.py:139, in make_github_contributors_mosaic(contributor_data, n_wide, n_high)
    137 images = []
    138 for contributor in contributor_data:
--> 139     response = requests.get(contributor['avatar_url'], stream=True)
    140     images.append(Image.open(response.raw))
    142 # randomize order

TypeError: string indices must be integers, not 'str'