osos.api_pypi.api_pypi.Pypi
- class Pypi[source]
- Bases: - object- Class to call pypi data and return osos-formatted pypi usage data. - Methods - get_daily_data(name, dates[, include_mirrors])- Get one month of usage data for a pypi package - get_data(name[, include_mirrors])- Get the dataframe for the last 180 days of download data - static get_data(name, include_mirrors=False)[source]
- Get the dataframe for the last 180 days of download data - Parameters:
- name (str) – pypi package name. Note that this should include the prefix for nrel packages e.g. reV -> nrel-rev 
- include_mirrors (bool) – Flag to include mirror downloads or not 
 
- Returns:
- out (pd.DataFrame) – DataFrame of pypistats data for the last 180 days with: “pypi_daily” and “pypi_180_cumulative”. Note that the 180 day cumulative is for the last 180 days from today’s actual date, not 180 days from the date in the output row index. 
 
 - classmethod get_daily_data(name, dates, include_mirrors=False)[source]
- Get one month of usage data for a pypi package - Parameters:
- name (str) – pypi package name. Note that this should include the prefix for nrel packages e.g. reV -> nrel-rev 
- dates (datetime.date | list) – One or more dates to retrieve data for 
- include_mirrors (bool) – Flag to include mirror downloads or not 
 
- Returns:
- out (pd.DataFrame) – DataFrame with sorted index of the “dates” input with: “pypi_daily” and “pypi_180_cumulative”. Note that the 180 day cumulative is for the last 180 days from today’s actual date, not 180 days from the date in the output row index.