100 free credits. No credit card required. Get a key

How to scrape PyPI project with Go

A Python project on PyPI: metadata and README, the release’s files, known vulnerabilities and every version with its upload date.

The examples use only the standard library (net/http, encoding/json) and decode into a struct that names just the fields they read.

GET /v1/pypi/project1 credit per callRefunded on failure

Before you start

  1. Get an API keySign up for 100 free credits, no card. Keys start with gs_live_.
  2. Put it in the environmentEvery example reads it from GROUNDSOCIAL_API_KEY: export GROUNDSOCIAL_API_KEY=gs_live_…
  3. Set up Gogo mod init example

Call PyPI project API from Go

GET /v1/pypi/project. Save this as main.go and run go run main.go.

main.go
package main

import (
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"net/url"
	"os"
	"time"
)

// The fields this program reads, as the recorded response has them.
type Page struct {
	Versions []map[string]any `json:"versions"`
}

var client = &http.Client{Timeout: 60 * time.Second}

func fetch(q url.Values) (*Page, error) {
	req, err := http.NewRequest("GET", "https://api.groundsocial.dev/v1/pypi/project"+"?"+q.Encode(), nil)
	if err != nil {
		return nil, err
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("GROUNDSOCIAL_API_KEY"))
	res, err := client.Do(req)
	if err != nil {
		return nil, err
	}
	defer res.Body.Close()
	if res.StatusCode != http.StatusOK {
		var e struct {
			Error struct {
				Code      string `json:"code"`
				Hint      string `json:"hint"`
				Retryable bool   `json:"retryable"`
			} `json:"error"`
		}
		json.NewDecoder(res.Body).Decode(&e)
		return nil, fmt.Errorf("%s: %s", e.Error.Code, e.Error.Hint)
	}
	var page Page
	if err := json.NewDecoder(res.Body).Decode(&page); err != nil {
		return nil, err
	}
	return &page, nil
}

func main() {
	q := url.Values{}
	q.Set("project", "requests")
	page, err := fetch(q)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", page)
}

The response

A real PyPI response to this call, recorded from the live API on 27 Nov 2026 and shortened for display: arrays keep their first items and … marks every cut. The recorded page had 163 items in versions. Live calls return current data in the same shape.

200 OK
{
  "info": {
    "name": "requests",
    "version": "2.34.2",
    "summary": "Python HTTP for Humans.",
    "description": "# Requests\n\n[![Version](https://img.shields.io/pypi/v/requests.svg?maxAge=86400)](https://…",
    "author": null,
    "author_email": "Kenneth Reitz <…@…>",
    "license": "Apache-2.0",
    "license_expression": null,
    "home_page": null,
    "project_urls": {
      "Documentation": "https://requests.readthedocs.io",
      "Source": "https://github.com/psf/requests"
    },
    "requires_python": ">=3.10",
    "requires_dist": [
      "charset_normalizer<4,>=2",
      "idna<4,>=2.5",
      "… 4 more"
    ],
    "classifiers": [
      "Development Status :: 5 - Production/Stable",
      "Environment :: Web Environment",
      "… 18 more"
    ],
    "keywords": null,
    "…": "16 more fields"
  },
  "urls": [
    {
      "filename": "requests-2.34.2-py3-none-any.whl",
      "url": "https://files.pythonhosted.org/packages/a0/f4/c67b0b3f1b9245e8d266f0f112c500d50e5b4e83cb6f…",
      "packagetype": "bdist_wheel",
      "python_version": "py3",
      "size": 73075,
      "upload_time_iso_8601": "2026-05-14T19:25:26.443000Z",
      "yanked": false,
      "digests": {
        "blake2b_256": "a0f4c67b0b3f1b9245e8d266f0f112c500d50e5b4e83cb6f3b71b6528104182a",
        "md5": "cc4287951c320ff794e5e183c7a91f85",
        "sha256": "2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0"
      },
      "comment_text": null,
      "core-metadata": {
        "sha256": "8c384ba3e979480faae2859d3c5e6c1276dd2c3616e322e124d52c8cfc556f27"
      },
      "downloads": -1,
      "has_sig": false,
      "md5_digest": "cc4287951c320ff794e5e183c7a91f85",
      "requires_python": ">=3.10",
      "…": "2 more fields"
    },
    {
      "filename": "requests-2.34.2.tar.gz",
      "url": "https://files.pythonhosted.org/packages/ac/c3/e2a2b89f2d3e2179abd6d00ebd70bff6273f37fb3e0c…",
      "packagetype": "sdist",
      "python_version": "source",
      "size": 142856,
      "upload_time_iso_8601": "2026-05-14T19:25:27.735762Z",
      "yanked": false,
      "digests": {
        "blake2b_256": "acc3e2a2b89f2d3e2179abd6d00ebd70bff6273f37fb3e0cc209f48b39d00cbf",
        "md5": "611e438d0803e962500225f9807a475e",
        "sha256": "f288924cae4e29463698d6d60bc6a4da69c89185ad1e0bcc4104f584e960b9ed"
      },
      "comment_text": null,
      "core-metadata": false,
      "downloads": -1,
      "has_sig": false,
      "md5_digest": "611e438d0803e962500225f9807a475e",
      "requires_python": ">=3.10",
      "…": "2 more fields"
    }
  ],
  "vulnerabilities": [],
  "ownership": {
    "organization": null,
    "roles": [
      {
        "role": "Owner",
        "user": "Lukasa"
      },
      {
        "role": "Owner",
        "user": "graffatcolmingov"
      },
      "… 1 more"
    ]
  },
  "last_serial": 37059094,
  "versions": [
    {
      "version": "2.34.2",
      "upload_time": "2026-05-14T19:25:26.443000Z",
      "yanked": false,
      "files": 2
    },
    {
      "version": "2.34.1",
      "upload_time": "2026-05-13T19:20:22.827819Z",
      "yanked": false,
      "files": 2
    },
    "… 161 more"
  ],
  "latest_version": "2.34.2",
  "url": "https://pypi.org/project/requests/2.34.2/"
}

Top-level fields

FieldTypeDescription
infoPypiInfo–
urlsPypiReleaseFile[]–
vulnerabilitiesobject[]–
ownershipobject–
last_serialinteger–
versionsobject[]Every release, newest upload first.
latest_versionstring–
urlstring–

Parameters

NameInTypeDescription
project (required)querystringProject name or pypi.org link. Example: requests.
versionquerystringA release such as 2.31.0. Defaults to the latest.

Errors and retries

Every error is JSON with error.code (stable: branch on it), message, hint (what to do next), docs_url and retryable. A failed call is never charged. Retry only when retryable is true, after the Retry-After header.

Errors
// fetch returns the API error as "code: hint". To retry the retryable ones
// (rate_limited, upstream_timeout), wait for Retry-After and call again:
for attempt := 0; attempt < 3; attempt++ {
	page, err = fetch(q)
	if err == nil {
		break
	}
	time.Sleep(2 * time.Second)
}
StatusMeaning
200The project release.
400Invalid input. Nothing was charged.
401Missing or invalid API key.
402Not enough credits, a spend cap was reached, or payment is required.
403The target is private, or the account is suspended.
404The project or release does not exist.
429Too many requests. Wait for Retry-After seconds.
503PyPI is temporarily unavailable. Retryable; nothing was charged.

Every error code and what to do about it.

Pricing

Cost
Per call1 credit per call
1,000 calls$1.00 on the starter pack, $0.40 at volume
No key (MPP or x402)$0.01 per call
Failed callRefunded, never charged

Every response has x-credits-charged and x-credits-remaining headers. Credits never expire. Packs and calculator.

From an AI agent (MCP)

The same call is the pypi_project_get tool on the hosted MCP server, so Claude, Cursor or any MCP client can make it without code. Add the server once:

bash
claude mcp add --transport http groundsocial https://api.groundsocial.dev/mcp

Then ask for it in words (“One PyPI project release: metadata, files, versions, vulnerabilities”), or call the tool directly:

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "pypi_project_get",
    "arguments": {
      "project": "requests"
    }
  }
}

MCP setup for Claude Desktop, Cursor, VS Code and ChatGPT.

Watch for new releases

Compare latest_version with the one you pinned.

Questions

Does it list vulnerabilities?

Yes, the ones PyPI lists for that release.

Keep going

Run it on your own data

One key for PyPI and 76 more platforms, over REST or MCP. Free credits on signup, no card.

PyPI is a trademark of the Python Software Foundation. We are not affiliated with or endorsed by the Python Software Foundation.