Coder Social home page Coder Social logo

igasparov / swapi-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phalt/swapi-python

0.0 0.0 0.0 36 KB

The Python helper library for swapi.co

Home Page: swapi.co

License: BSD 3-Clause "New" or "Revised" License

Makefile 8.25% Python 91.75%

swapi-python's Introduction

swapi-python

https://badge.fury.io/py/swapi.png https://travis-ci.org/phalt/swapi-python.png?branch=master https://pypip.in/d/swapi/badge.png

A Python helper library for swapi.co - the Star Wars API

NOTE: Tests will run against hosted API as opposed to data from github repo

Installation

At the command line:

$ pip install swapi

Basic Usage

To use swapi-python in a project:

import swapi

All resources are accessible through the top-level get_resource() methods:

luke = swapi.get_person(1)
tatooine = swapi.get_planet(1)

Methods

These are the top-level methods you can use to get resources from swapi.co. To learn more about the models and objects that are returned, see the models page.

get_person(id)

Return a single Person resource.

Example:

swapi.get_person(1)
>>> <Person - Luke Skywalker>

get_planet(id)

Return a single Planet resource.

Example:

swapi.get_planet(1)
>>> <Planet - Tatooine>

get_starship(id)

Return a single Starship resource.

Example:

swapi.get_starship(6)
>>> <Starship - Death Star>

get_vehicle(id)

Return a single Vehicle resource.

Example:

swapi.get_vehicle(4)
>>> <Vehicle - Sand Crawler>

get_film(id)

Return a single Film resource.

Example:

swapi.get_film(1)
>>> <Film - A New Hope>

get_all("resource")

Return a QuerySet containing all the items in a single resource. See the `models` page for more information on the models used in swapi-python.

Example:

swapi.get_all("films")
>>> <FilmQuerySet - 6>

swapi-python's People

Contributors

phalt avatar windwaker avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.