Skip to main content

SpaceX REST API wrapping with aiohttp

Project description

SpaceXPy

A wrapper that supports asynchronous.

This package is Asynchronous wrapping of the informal SpaceX REST API.

Install

pip install spacexpy

Quick Example

Sync

import spacexpy

spacex = spacexpy.SpaceX()
cl = spacex.company()

print(cl.headquarters)
print(cl.headquarters.address)

Async

import asyncio
import spacexpy

async def main():
    spacex = spacexpy.SpaceX()
    cl = await spacex.company()
    print(cl.headquarters)
    print(cl.headquarters.address)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Print:

{"address": "Rocket Road", "city": "Hawthorne", "state": "California"}
Rocket Road

Get all list

Sync

import spacexpy


spacex = spacexpy.SpaceX()
cl = spacex.capsules()

print(cl)

Async

import asyncio
import spacexpy

async def main():
    spacex = spacexpy.SpaceX()
    cl = await spacex.capsules()
    print(cl)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Print:

[
    {
        "reuse_count": 1,
        "water_landings": 1,
        "land_landings": 0,
        "last_update": "Reentered after three weeks in orbit",
        "launches": [
            "5eb87cdeffd86e000604b330"
        ],
        "serial": "C101",
        "status": "retired",
        "id": "5e9e2c5bf35918ed873b2664"
    },
    ...
]

Attribute

Check this docs

Patch note

2.0.2

2.0.1

2.0.0

  • Now support Sync
  • Change model
  • PR #3

1.0.1

  • Grammer fix 1.0.1: PR #1

1.0.0

  • Released 1.0.0: All endpoints cover

Contributing

You can Open an issue or submit PRs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spacexpy-2.0.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

spacexpy-2.0.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file spacexpy-2.0.2.tar.gz.

File metadata

  • Download URL: spacexpy-2.0.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.1

File hashes

Hashes for spacexpy-2.0.2.tar.gz
Algorithm Hash digest
SHA256 95dd47a8132e364f9ab27bfcb708b6f4425479e8d67c28fc22ba858e35f56d68
MD5 7d202ac5b8d8aad638427471b976b0af
BLAKE2b-256 c181a9dacd25bc7c132d7cc2cb9f47d92c1b997521688c11311a3c7b09e34dd5

See more details on using hashes here.

File details

Details for the file spacexpy-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: spacexpy-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.1

File hashes

Hashes for spacexpy-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cf5351b5b7525fdec53b5eece2371b150b382f5a26b0ac6b3403e1df99639399
MD5 0ba2d428f675f337a05dfbca07e22f01
BLAKE2b-256 b63083dee7defd81c5e28fe91122604dff2fa991936555c48808a5fdba043939

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page