Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.

README - add syntax highlighting #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,27 @@ Install `coreapi` and the `raml-codec`.
To use the Python client library to interact with a service that exposes a Swagger schema,
include the codec in [the `decoders` argument][decoders].

>>> from raml_codec import RAMLCodec
>>> from coreapi.codecs import JSONCodec
>>> from coreapi import Client
>>> decoders = [RAMLCodec(), JSONCodec()]
>>> client = Client(decoders=decoders)
```py
>>> from raml_codec import RAMLCodec
>>> from coreapi.codecs import JSONCodec
>>> from coreapi import Client
>>> decoders = [RAMLCodec(), JSONCodec()]
>>> client = Client(decoders=decoders)
```

If the server exposes the schema without properly using an `application/raml+yaml` content type, then you'll need to make sure to include `format='raml'` on the initial request,
to force the correct codec to be used.

>>> url = 'https://raw.githubusercontent.com/spotify/web-api/master/specifications/raml/api.raml'
>>> schema = client.get(url, format='raml')
```py
>>> url = 'https://raw.githubusercontent.com/spotify/web-api/master/specifications/raml/api.raml'
>>> schema = client.get(url, format='raml')
```

At this point you can now start to interact with the API:

>>> client.action(schema, ['search-item'], params={'q': 'Deadmaus', 'type': 'artist'})
```py
>>> client.action(schema, ['search-item'], params={'q': 'Deadmaus', 'type': 'artist'})
```

## Using with the Command Line Client

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy