A Python helper library for swapi.co - the Star Wars API
Project description
===============================
swapi-python
===============================
.. image:: https://badge.fury.io/py/swapi.png
:target: http://badge.fury.io/py/swapi
.. image:: https://travis-ci.org/phalt/swapi-python.png?branch=master
:target: https://travis-ci.org/phalt/swapi-python
.. image:: https://pypip.in/d/swapi/badge.png
:target: https://pypi.python.org/pypi/swapi
A Python helper library for swapi.co - the Star Wars API
* Free software: BSD license
* Documentation: https://swapi-python.readthedocs.org.
============
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_planet(1)
>>> <Planet - 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>
History
-------
0.1.0 (2014-12-21)
---------------------
* First release on PyPI.
0.1.2 (214-12-22)
------------------
* Python 3.3 and Python 3.4 compatability
swapi-python
===============================
.. image:: https://badge.fury.io/py/swapi.png
:target: http://badge.fury.io/py/swapi
.. image:: https://travis-ci.org/phalt/swapi-python.png?branch=master
:target: https://travis-ci.org/phalt/swapi-python
.. image:: https://pypip.in/d/swapi/badge.png
:target: https://pypi.python.org/pypi/swapi
A Python helper library for swapi.co - the Star Wars API
* Free software: BSD license
* Documentation: https://swapi-python.readthedocs.org.
============
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_planet(1)
>>> <Planet - 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>
History
-------
0.1.0 (2014-12-21)
---------------------
* First release on PyPI.
0.1.2 (214-12-22)
------------------
* Python 3.3 and Python 3.4 compatability
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
swapi-0.1.2.tar.gz
(15.6 kB
view hashes)
Built Distribution
Close
Hashes for swapi-0.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 037a112504832a512ff37f11157bb376449c9bb258a261cde8b0de4298e95af5 |
|
MD5 | f1157e81d2fe91824ede3180e9fc7d12 |
|
BLAKE2b-256 | 4b5c9a9255d23e4ba4543f26f9879191b4e39d7a8d7a2f16096592997b0d0687 |