Procházet zdrojové kódy

Merge pull request #589 from davemachado/add-cors-column

Add CORS column
pull/590/head
Dave Machado před 6 roky
committed by GitHub
rodič
revize
67422f7508
V databázi nebyl nalezen žádný známý klíč pro tento podpis ID GPG klíče: 4AEE18F83AFDEB23
4 změnil soubory, kde provedl 615 přidání a 600 odebrání
  1. +11
    -5
      .github/CONTRIBUTING.md
  2. +593
    -593
      README.md
  3. +2
    -1
      build/md2json.py
  4. +9
    -1
      build/validate_format.py

+ 11
- 5
.github/CONTRIBUTING.md Zobrazit soubor

@@ -10,23 +10,29 @@ community build applications and use free, public APIs quickly and easily. Pull


Current API entry format: Current API entry format:


| API | Description | Auth | HTTPS | Link |
| --- | --- | --- | --- | --- |
| API Title | Description of API | Does this API require authentication? * | Does the API support HTTPS? | Link to API webpage |
| API | Description | Auth | HTTPS | CORS | Link |
| --- | --- | --- | --- | --- | --- |
| API Title | Description of API | Does this API require authentication? * | Does the API support HTTPS? | Does the API support [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)? * | Link to API webpage |


Example entry: Example entry:


``` ```
| NASA | NASA data, including imagery | No | Yes | [Go!](https://api.nasa.gov) |
| NASA | NASA data, including imagery | No | Yes | Yes | [Go!](https://api.nasa.gov) |
``` ```


\* Currently, the only accepted inputs for this field are as follows:
\* Currently, the only accepted inputs for the `Auth` field are as follows:


* `OAuth` - _the API supports OAuth_ * `OAuth` - _the API supports OAuth_
* `apiKey` - _the API uses a private key string/token for authentication - try and use the correct parameter_ * `apiKey` - _the API uses a private key string/token for authentication - try and use the correct parameter_
* `X-Mashape-Key` - _the name of the header which may need to be sent_ * `X-Mashape-Key` - _the name of the header which may need to be sent_
* `No` - _the API requires no authentication to run_ * `No` - _the API requires no authentication to run_


\* Currently, the only accepted inputs for the `CORS` field are as follows:

* `Yes` - _the API supports CORS_
* `No` - _the API does not support CORS_
* `Unknown` - _it is unknown if the API supports CORS_

Please continue to follow the alphabetical ordering that is in place per section. Each table column should be padded with one space on either side. Please continue to follow the alphabetical ordering that is in place per section. Each table column should be padded with one space on either side.


If an API seems to fall into multiple categories, please place the listing within the section most in line with the services offered through the API. For example, the Instagram API is listed under `Social` since it is mainly a social network, even though it could also apply to `Photography`. If an API seems to fall into multiple categories, please place the listing within the section most in line with the services offered through the API. For example, the Instagram API is listed under `Social` since it is mainly a social network, even though it could also apply to `Photography`.


+ 593
- 593
README.md
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 2
- 1
build/md2json.py Zobrazit soubor

@@ -22,7 +22,8 @@ def markdown_to_json(filename, anchor):
'Description': chunks[1], 'Description': chunks[1],
'Auth': None if chunks[2].upper() == 'NO' else chunks[2].strip('`'), 'Auth': None if chunks[2].upper() == 'NO' else chunks[2].strip('`'),
'HTTPS': True if chunks[3].upper() == 'YES' else False, 'HTTPS': True if chunks[3].upper() == 'YES' else False,
'Link': chunks[4].replace('[Go!]', '')[1:-1],
'CORS': chunks[4].strip('`'),
'Link': chunks[5].replace('[Go!]', '')[1:-1],
'Category': category, 'Category': category,
} }
entries.append(entry) entries.append(entry)


+ 9
- 1
build/validate_format.py Zobrazit soubor

@@ -8,12 +8,14 @@ anchor = '###'
auth_keys = ['apiKey', 'OAuth', 'X-Mashape-Key', 'No'] auth_keys = ['apiKey', 'OAuth', 'X-Mashape-Key', 'No']
punctuation = ['.', '?', '!'] punctuation = ['.', '?', '!']
https_keys = ['Yes', 'No'] https_keys = ['Yes', 'No']
cors_keys = ['Yes', 'No', 'Unknown']


index_title = 0 index_title = 0
index_desc = 1 index_desc = 1
index_auth = 2 index_auth = 2
index_https = 3 index_https = 3
index_link = 4
index_cors = 4
index_link = 5


errors = [] errors = []


@@ -91,6 +93,12 @@ def check_format(filename):
if https not in https_keys: if https not in https_keys:
add_error(line_num, "{} is not a valid HTTPS option".format(https)) add_error(line_num, "{} is not a valid HTTPS option".format(https))
# END HTTPS # END HTTPS
# START CORS
# values should conform to valid options only
cors = segments[index_cors]
if cors not in cors_keys:
add_error(line_num, "{} is not a valid CORS option".format(cors))
# END CORS
# START Link # START Link
# url should be wrapped in '[Go!]()' Markdown syntax # url should be wrapped in '[Go!]()' Markdown syntax
link = segments[index_link] link = segments[index_link]


Načítá se…
Zrušit
Uložit