Skip to content

Commit 6bdf9f2

Browse files
committed
chore(pkg): use pandoc to generate package rst from redme
1 parent ba8a4b8 commit 6bdf9f2

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Python API Client for the Flat REST API
1+
# Python Client for the Flat REST API
22

33
[![Build Status](https://travis-ci.org/FlatIO/api-client-python.svg?branch=master)](https://travis-ci.org/FlatIO/api-client-python)
44

@@ -30,7 +30,7 @@ pip install git+https://github.com/FlatIO/api-client-python.git
3030

3131
Then import the package:
3232
```python
33-
import flat_api
33+
import flat_api
3434
```
3535

3636
### Setuptools
@@ -147,15 +147,14 @@ Class | Method | HTTP request | Description
147147
- **Type**: OAuth
148148
- **Flow**: accessCode
149149
- **Authorization URL**: https://flat.io/auth/oauth
150-
- **Scopes**:
151-
- **account.public_profile**: Provides access to the basic person's public profile. Education profiles may be anonymized with this scope, you can request the scope `education_profile` to access to the a basic education account profile.
152-
- **account.education_profile**: Provides access to the basic person's education profile and public organization information.
153-
- **scores.readonly**: Allows read-only access to all a user's scores. You won't need this scope to read public scores.
154-
- **scores.social**: Allow to post comments and like scores
155-
- **scores**: Full, permissive scope to access all of a user's scores.
150+
- **Scopes**:
151+
- **account.public_profile**: Provides access to the basic person's public profile. Education profiles may be anonymized with this scope, you can request the scope `education_profile` to access to the a basic education account profile.
152+
- **account.education_profile**: Provides access to the basic person's education profile and public organization information.
153+
- **scores.readonly**: Allows read-only access to all a user's scores. You won't need this scope to read public scores.
154+
- **scores.social**: Allow to post comments and like scores
155+
- **scores**: Full, permissive scope to access all of a user's scores.
156156

157157

158158
## Author
159159

160160
Flat - developers@flat.io
161-

setup.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
"""
44
Flat API
55
6-
# Introduction The Flat API allows you to easily extend the abilities of the [Flat Platform](https://flat.io), with a wide range of use cases including the following: - Creating and importing new music scores using MusicXML or MIDI files - Browsing, updating, copying, exporting the user's scores (for example in MP3, WAV or MIDI) - Managing educational resources with Flat for Education: creating & updating the organization accounts, the classes, rosters and assignments. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). # Beta Please note that this public API is currently in beta and subject to change. Our whole platform and apps are based on this API, however not all the endpoints are available publicly yet. Feel free to [contact us](mailto:developers@flat.io) if you have any questions, feedback or features requests. We don't offer any guarantees during this beta period. By using this API, you agree to update your app in a timely fashion in response to any beta-period changes that are rolled out. By using this API, and especially on the behalf of a user account, you must accept, respect and enforce our [Terms of Service and Privacy Policy](https://flat.io/legal). # Authentication The Flat API supports OAuth2, you can request API credentials [on our website](https://flat.io/developers). We provide two types of credentials: - **Account Access Tokens**: Simple access tokens that allow to try and use this API **with your own account**. This is a great solution to create private apps. - **OAuth2 Credentials**: If you plan to use the Flat API **on the behalf of mutliple users** or make this app public, request OAuth2 Credentials. <!-- ReDoc-Inject: <security-definitions> --> ### OAuth2 Authorization page The Authorization page (`https://flat.io/auth/oauth`) supports all the standard parameters from the **Authorization Code** flow ([RFC6749/4.1.1](https://tools.ietf.org/html/rfc6749#section-4.1.1)) and the **Implicit** flow ([RFC6749/4.2.1](https://tools.ietf.org/html/rfc6749#section-4.2.1)). Here is a summary of the parameters available, including non-standard and optional parameters. All of them can be passed as query string when redirecting the end-user to the authorization page. Property name | Required | Values and Description ---------------|----------|----------------------- `client_id` | Required | The client id (aka key) from the couple key/secret provided by Flat `response_type`| Required | We support `code` (**Authorization Code** flow, [RFC6749/4.1.1](https://tools.ietf.org/html/rfc6749#section-4.1.1)) and `token`, [RFC6749/4.2.1](https://tools.ietf.org/html/rfc6749#section-4.2.1)). It is strongly advised to use the Authorization Code flow for any server-side usage and the Implicit flow for any client-side (e.g. JavaScript) usage. `scope` | Required | You must provide a list of scopes listed above and granted for your app, separated with a space. `redirect_uri` | Required | Determines where the response is sent. The value of this parameter must exactly match the value specified in your App Credentials settings. `state` | Optional | An opaque string that is round-tripped in the protocol; that is to say, it is returned as a URI parameter in the Basic flow, and in the URI #fragment in the Implicit flow. `access_type` | Optional, only available for the Authorization Code flow | The acceptable values are `online` and `offline`. When specifying `offline`, the API will return a refresh token during the access token exchange. ### OAuth2 tokens revocation This OAuth2 API supports token revocation ([RFC 7009](http://tools.ietf.org/html/rfc7009)) at the following endpoint: `https://api.flat.io/oauth/invalidate_token`. # CORS This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site. # Rate Limiting For authenticated requests, you can make up to 5,000 requests per hour. For unauthenticated requests, the rate limit allows you to make up to 500 requests per hour. Unauthenticated requests are associated with your IP address, and not the user or app making requests. You can contact us if you need [extra quota](https://flat.io/developers). To protect our quality of service, additional rate limits may apply to some API calls or actions. You can check the returned HTTP headers of any API request to see your current rate limit status: ```bash curl -i https://api.flat.io/v2/me HTTP/1.1 200 OK Date: Sat, 25 Mar 2017 17:06:20 GMT X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4999 X-RateLimit-Reset: 1490465178 ``` The headers tell you everything you need to know about your current rate limit status: Header name | Description ------------|------------ `X-RateLimit-Limit` | The maximum number of requests that the consumer is permitted to make per hour. `X-RateLimit-Remaining` | The number of requests remaining in the current rate limit window. This value can be negative if you try to go over the allowed quota. `X-RateLimit-Reset` | The time at which the current rate limit window resets in [UTC epoch seconds](http://en.wikipedia.org/wiki/Unix_time). If you need the time in a different format, any modern programming language can get the job done. For example, if you open up the console on your web browser, you can easily get the reset time as a JavaScript Date object. ```javascript new Date(1490465178 * 1000).toString() 'Sat Mar 25 2017 19:06:18 GMT+0100 (CET)' ``` Once you go over the rate limit you will receive an error response: ```bash curl -i https://api.flat.io/v2/me HTTP/1.1 403 Forbidden X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 0 X-RateLimit-Reset: 1490465829 { \"message\": \"API rate limit exceeded for xx.xxx.xxx.xx\", \"code\": \"API_RATE_LIMIT_EXCEEDED\" } ```
7-
86
OpenAPI spec version: 2.0.0
97
Contact: developers@flat.io
108
Generated by: https://github.com/swagger-api/swagger-codegen.git
@@ -25,17 +23,21 @@
2523

2624
REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"]
2725

26+
try:
27+
import pypandoc
28+
LONG_DESCRIPTION = pypandoc.convert('README.md', 'rst')
29+
except(IOError, ImportError):
30+
LONG_DESCRIPTION = open('README.md').read()
31+
2832
setup(
2933
name=NAME,
3034
version=VERSION,
31-
description="Flat API",
35+
description="Flat API Client",
3236
author_email="developers@flat.io",
3337
url="https://github.com/FlatIO/api-client-python",
34-
keywords=["Swagger", "Flat API"],
38+
keywords=["Flat API", "MusicXML", "Music Notation", "MIDI"],
39+
long_description=LONG_DESCRIPTION,
3540
install_requires=REQUIRES,
3641
packages=find_packages(),
37-
include_package_data=True,
38-
long_description="""\
39-
# Introduction The Flat API allows you to easily extend the abilities of the [Flat Platform](https://flat.io), with a wide range of use cases including the following: - Creating and importing new music scores using MusicXML or MIDI files - Browsing, updating, copying, exporting the user&#39;s scores (for example in MP3, WAV or MIDI) - Managing educational resources with Flat for Education: creating &amp; updating the organization accounts, the classes, rosters and assignments. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). You can use your favorite HTTP/REST library for your programming language to use Flat&#39;s API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). # Beta Please note that this public API is currently in beta and subject to change. Our whole platform and apps are based on this API, however not all the endpoints are available publicly yet. Feel free to [contact us](mailto:developers@flat.io) if you have any questions, feedback or features requests. We don&#39;t offer any guarantees during this beta period. By using this API, you agree to update your app in a timely fashion in response to any beta-period changes that are rolled out. By using this API, and especially on the behalf of a user account, you must accept, respect and enforce our [Terms of Service and Privacy Policy](https://flat.io/legal). # Authentication The Flat API supports OAuth2, you can request API credentials [on our website](https://flat.io/developers). We provide two types of credentials: - **Account Access Tokens**: Simple access tokens that allow to try and use this API **with your own account**. This is a great solution to create private apps. - **OAuth2 Credentials**: If you plan to use the Flat API **on the behalf of mutliple users** or make this app public, request OAuth2 Credentials. &lt;!-- ReDoc-Inject: &lt;security-definitions&gt; --&gt; ### OAuth2 Authorization page The Authorization page (&#x60;https://flat.io/auth/oauth&#x60;) supports all the standard parameters from the **Authorization Code** flow ([RFC6749/4.1.1](https://tools.ietf.org/html/rfc6749#section-4.1.1)) and the **Implicit** flow ([RFC6749/4.2.1](https://tools.ietf.org/html/rfc6749#section-4.2.1)). Here is a summary of the parameters available, including non-standard and optional parameters. All of them can be passed as query string when redirecting the end-user to the authorization page. Property name | Required | Values and Description ---------------|----------|----------------------- &#x60;client_id&#x60; | Required | The client id (aka key) from the couple key/secret provided by Flat &#x60;response_type&#x60;| Required | We support &#x60;code&#x60; (**Authorization Code** flow, [RFC6749/4.1.1](https://tools.ietf.org/html/rfc6749#section-4.1.1)) and &#x60;token&#x60;, [RFC6749/4.2.1](https://tools.ietf.org/html/rfc6749#section-4.2.1)). It is strongly advised to use the Authorization Code flow for any server-side usage and the Implicit flow for any client-side (e.g. JavaScript) usage. &#x60;scope&#x60; | Required | You must provide a list of scopes listed above and granted for your app, separated with a space. &#x60;redirect_uri&#x60; | Required | Determines where the response is sent. The value of this parameter must exactly match the value specified in your App Credentials settings. &#x60;state&#x60; | Optional | An opaque string that is round-tripped in the protocol; that is to say, it is returned as a URI parameter in the Basic flow, and in the URI #fragment in the Implicit flow. &#x60;access_type&#x60; | Optional, only available for the Authorization Code flow | The acceptable values are &#x60;online&#x60; and &#x60;offline&#x60;. When specifying &#x60;offline&#x60;, the API will return a refresh token during the access token exchange. ### OAuth2 tokens revocation This OAuth2 API supports token revocation ([RFC 7009](http://tools.ietf.org/html/rfc7009)) at the following endpoint: &#x60;https://api.flat.io/oauth/invalidate_token&#x60;. # CORS This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site. # Rate Limiting For authenticated requests, you can make up to 5,000 requests per hour. For unauthenticated requests, the rate limit allows you to make up to 500 requests per hour. Unauthenticated requests are associated with your IP address, and not the user or app making requests. You can contact us if you need [extra quota](https://flat.io/developers). To protect our quality of service, additional rate limits may apply to some API calls or actions. You can check the returned HTTP headers of any API request to see your current rate limit status: &#x60;&#x60;&#x60;bash curl -i https://api.flat.io/v2/me HTTP/1.1 200 OK Date: Sat, 25 Mar 2017 17:06:20 GMT X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4999 X-RateLimit-Reset: 1490465178 &#x60;&#x60;&#x60; The headers tell you everything you need to know about your current rate limit status: Header name | Description ------------|------------ &#x60;X-RateLimit-Limit&#x60; | The maximum number of requests that the consumer is permitted to make per hour. &#x60;X-RateLimit-Remaining&#x60; | The number of requests remaining in the current rate limit window. This value can be negative if you try to go over the allowed quota. &#x60;X-RateLimit-Reset&#x60; | The time at which the current rate limit window resets in [UTC epoch seconds](http://en.wikipedia.org/wiki/Unix_time). If you need the time in a different format, any modern programming language can get the job done. For example, if you open up the console on your web browser, you can easily get the reset time as a JavaScript Date object. &#x60;&#x60;&#x60;javascript new Date(1490465178 * 1000).toString() &#39;Sat Mar 25 2017 19:06:18 GMT+0100 (CET)&#39; &#x60;&#x60;&#x60; Once you go over the rate limit you will receive an error response: &#x60;&#x60;&#x60;bash curl -i https://api.flat.io/v2/me HTTP/1.1 403 Forbidden X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 0 X-RateLimit-Reset: 1490465829 { \&quot;message\&quot;: \&quot;API rate limit exceeded for xx.xxx.xxx.xx\&quot;, \&quot;code\&quot;: \&quot;API_RATE_LIMIT_EXCEEDED\&quot; } &#x60;&#x60;&#x60;
40-
"""
42+
include_package_data=True
4143
)

0 commit comments

Comments
 (0)