URL2io API SDK
Project description
url2io-client
URL2io API SDK包含 URL2Article 和 URL2NLP 两个服务,实现网页结构智能解析和文本信息智能处理。 SDK 使用文档,见 https://github.com/url2io/url2io-python-client 。 SDK 涉及的 Rest API,见 http://url2io.applinzi.com/docs
Requirements.
Python 2.7 and 3.4+
Installation & Usage
pip install
pip install url2io-client
or
If the python package is hosted on Github, you can install directly from Github
pip install git+https://github.com/url2io/url2io-python-client.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/url2io/url2io-python-client.git
)
Then import the package:
import url2io_client
Setuptools
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import url2io_client
Getting Started
Please follow the installation procedure and then run the following:
from __future__ import print_function
import time
import url2io_client
from url2io_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: token_in_query
configuration = url2io_client.Configuration()
configuration.host = 'YOUR_API_SERVICE_URL' # 你申请的服务地址,默认为体验版地址:http://url2api.applinzi.com
configuration.api_key['token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['token'] = 'Bearer'
# create an instance of the API class
api_instance = url2io_client.URL2ArticleApi(url2io_client.ApiClient(configuration))
url = 'url_example' # str | 要提取正文网页的网址,参考 [URL Encoding](http://www.w3schools.com/tags/ref_urlencode.asp)
fields = ['fields_example'] # list[str] | 指示需要额外返回的额外字段,取值为: - `next`: 表示要提取下一页链接。 - `text`: 表示要返回正文的纯文字格式。 - `markdown`: 表示返回正文的markdown格式。 构造url时多个值通过','号隔开,如`?fields=text,next`。调用sdk时使用列表即可,如fields= ['text', 'markdown']。 (optional)
param_callback = 'param_callback_example' # str | 使用jsonp实现Ajax跨域请求时需要传此参数 (optional)
try:
# 网页结构智能解析 HTTP Get 接口
api_response = api_instance.get_article(url, fields=fields, param_callback=param_callback)
pprint(api_response)
except ApiException as e:
print("Exception when calling URL2ArticleApi->get_article: %s\n" % e)
Documentation for API Endpoints
All URIs are relative to http://url2api.applinzi.com or your API_SERVICE_URL
Class | Method | HTTP request | Description |
---|---|---|---|
URL2ArticleApi | get_article | GET /article | 网页结构智能解析 HTTP Get 接口 |
URL2ArticleApi | get_article_by_post | POST /article | 网页结构智能解析 HTTP Post 接口 |
URL2NLPApi | get_keywords | POST /v1/nlp/keywords | 关键词提取接口 |
URL2NLPApi | get_word_cut | POST /v1/nlp/word/cut | 中文分词和词性注解接口 |
more details: https://github.com/url2io/url2io-python-client/tree/master/src#documentation-for-api-endpoints
Documentation For Models
- ArticleForResponse
- NlpKeywordsItemForResponse
- NlpWordCutItemForResponse
more details: https://github.com/url2io/url2io-python-client/tree/master/src#documentation-for-models
Documentation For Authorization
token_in_query
- Type: API key
- API key parameter name: token
- Location: URL query string
Author
url2#sina.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file url2io-client-1.0.1.tar.gz
.
File metadata
- Download URL: url2io-client-1.0.1.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 920c48dd711074af421f32be219e552332b05e5fb6ab1c0c926ab6dbd099f6e4 |
|
MD5 | c7484313b014124c874df80a18025095 |
|
BLAKE2b-256 | e6e080d52cac0b6132cca9b977301847d19e906083751e9d30f06c9ae011b690 |
File details
Details for the file url2io_client-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: url2io_client-1.0.1-py3-none-any.whl
- Upload date:
- Size: 33.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cea7e646456d36e68401e501100751c474f7a14beac8acbf791668aadf670fc9 |
|
MD5 | 0705d6de9c1e5def127797daa66e635d |
|
BLAKE2b-256 | 25e570dd28552370b0b4520fd21a359d3cae5450e54fb62ce6335d8ea4373ca5 |