Software Heritage GraphQL Apis
Project description
This repository holds the development of Software Heritage GraphQL API. A staging version of this service is available at https://graphql.staging.swh.network
Running locally
Refer to https://docs.softwareheritage.org/devel/getting-started.html#getting-started for running software heritage services locally.
If you wish to run SWH-GraphQL independently, and have access to SWH storage services, following make targets can be used.
make run-dev: Use the config file at swh/graphql/config/dev.yml and start the service in auto-reload mode using uvicorn
make run-dev-stable: Use the config file at swh/graphql/config/dev.yml and start the service using uvicorn
make run-wsgi: Use the config file at swh/graphql/config/staging.yml and start the service in gunicorn using uvicorn workers
make run-dev-docker: Run the service inside a docker container and Use the config file at swh/graphql/config/dev.yml
make run-wsgi-docker: Run the service inside a docker container and Use the config file at swh/graphql/config/staging.yml
visit http://localhost:8000 to use the query explorer
Running a query
The easiest way to run a query is using the query explorer. Please provide an SWH API token if you wish to run bigger queries.
Using curl
curl -i -H 'Content-Type: application/json' -H "Authorization: bearer your-api-token" -X POST -d '{"query": "query {origins(first: 2) {nodes {url}}}"}' http://127.0.0.1:8000
Using Python requests
import requests
url = "http://127.0.0.1:8000"
query = """
{
origins(first: 2) {
pageInfo {
hasNextPage
endCursor
}
edges {
node {
url
}
}
}
}
"""
json = {"query" : query}
api_token = "your-api-token"
headers = {'Authorization': 'Bearer %s' % api_token}
r = requests.post(url=url, json=json, headers=headers)
print (r.json())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file swh.graphql-0.0.8.2.tar.gz
.
File metadata
- Download URL: swh.graphql-0.0.8.2.tar.gz
- Upload date:
- Size: 56.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b724175287283a8bc0d934a605c0478d42b68e182c2c3a97a842af51c61d85fe |
|
MD5 | ba02ec40e9922c2a5119dd8a9fc105ff |
|
BLAKE2b-256 | 926e5f115d62a3314fd9296572b93834d71f0f94f0122448628a2b0ccb76c36e |
File details
Details for the file swh.graphql-0.0.8.2-py3-none-any.whl
.
File metadata
- Download URL: swh.graphql-0.0.8.2-py3-none-any.whl
- Upload date:
- Size: 83.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1a8a86084131cc5dc96557371bd471a7da433d834da7d7ead399995a8803fc7 |
|
MD5 | dc50e073227a133831f7461faa7266c3 |
|
BLAKE2b-256 | 26d8b9f7fa818367869888aa10dfe11fea9865d65f48c09acc5519ac39ac2a69 |