Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR cognitiveservices/data-plane/NewsSearch] typo: cognitiveservices/data-plane/NewsSearch #3920

Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions azure-cognitiveservices-search-newssearch/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
include *.rst
include azure/__init__.py
include azure/cognitiveservices/__init__.py
include azure/cognitiveservices/search/__init__.py

Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
# regenerated.
# --------------------------------------------------------------------------

from .news_search_api import NewsSearchAPI
from .news_search_client import NewsSearchClient
from .version import VERSION

__all__ = ['NewsSearchAPI']
__all__ = ['NewsSearchClient']

__version__ = VERSION

Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from .error_response import ErrorResponse, ErrorResponseException
from .media_object import MediaObject
from .response_base import ResponseBase
from .news_search_api_enums import (
from .news_search_client_enums import (
ErrorCode,
ErrorSubCode,
Freshness,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .response import Response
from .response_py3 import Response


class Answer(Response):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .creative_work import CreativeWork
from .creative_work_py3 import CreativeWork


class Article(CreativeWork):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .thing import Thing
from .thing_py3 import Thing


class CreativeWork(Thing):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .response import Response
from .response_py3 import Response
from msrest.exceptions import HttpOperationError


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .response_base import ResponseBase
from .response_base_py3 import ResponseBase


class Identifiable(ResponseBase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .media_object import MediaObject
from .media_object_py3 import MediaObject


class ImageObject(MediaObject):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .creative_work import CreativeWork
from .creative_work_py3 import CreativeWork


class MediaObject(CreativeWork):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .article import Article
from .article_py3 import Article


class NewsArticle(Article):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .search_results_answer import SearchResultsAnswer
from .search_results_answer_py3 import SearchResultsAnswer


class News(SearchResultsAnswer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .thing import Thing
from .thing_py3 import Thing


class NewsTopic(Thing):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .thing import Thing
from .thing_py3 import Thing


class Organization(Thing):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .identifiable import Identifiable
from .identifiable_py3 import Identifiable


class Response(Identifiable):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .answer import Answer
from .answer_py3 import Answer


class SearchResultsAnswer(Answer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .response import Response
from .response_py3 import Response


class Thing(Response):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .answer import Answer
from .answer_py3 import Answer


class TrendingTopics(Answer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .media_object import MediaObject
from .media_object_py3 import MediaObject


class VideoObject(MediaObject):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,52 +16,60 @@
from . import models


class NewsSearchAPIConfiguration(Configuration):
"""Configuration for NewsSearchAPI
class NewsSearchClientConfiguration(Configuration):
"""Configuration for NewsSearchClient
Note that all parameters used to create this instance are saved as instance
attributes.

:param endpoint: Supported Cognitive Services endpoints (protocol and
hostname, for example: "https://westus.api.cognitive.microsoft.com",
"https://api.cognitive.microsoft.com").
:type endpoint: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
:param str base_url: Service URL
"""

def __init__(
self, credentials, base_url=None):
self, endpoint, credentials):

if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if not base_url:
base_url = 'https://api.cognitive.microsoft.com/bing/v7.0'
base_url = '{Endpoint}/bing/v7.0'

super(NewsSearchAPIConfiguration, self).__init__(base_url)
super(NewsSearchClientConfiguration, self).__init__(base_url)

self.add_user_agent('azure-cognitiveservices-search-newssearch/{}'.format(VERSION))

self.endpoint = endpoint
self.credentials = credentials


class NewsSearchAPI(SDKClient):
class NewsSearchClient(SDKClient):
"""The News Search API lets you send a search query to Bing and get back a list of news that are relevant to the search query. This section provides technical details about the query parameters and headers that you use to request news and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the web for news](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-news-search/search-the-web).

:ivar config: Configuration for client.
:vartype config: NewsSearchAPIConfiguration
:vartype config: NewsSearchClientConfiguration

:ivar news: News operations
:vartype news: azure.cognitiveservices.search.newssearch.operations.NewsOperations

:param endpoint: Supported Cognitive Services endpoints (protocol and
hostname, for example: "https://westus.api.cognitive.microsoft.com",
"https://api.cognitive.microsoft.com").
:type endpoint: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
:param str base_url: Service URL
"""

def __init__(
self, credentials, base_url=None):
self, endpoint, credentials):

self.config = NewsSearchAPIConfiguration(credentials, base_url)
super(NewsSearchAPI, self).__init__(self.config.credentials, self.config)
self.config = NewsSearchClientConfiguration(endpoint, credentials)
super(NewsSearchClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '1.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ def search(
"""
# Construct URL
url = self.search.metadata['url']
path_format_arguments = {
'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
Expand Down Expand Up @@ -350,7 +354,7 @@ def search(

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)
header_parameters['X-BingApis-SDK'] = self._serialize.header("self.x_bing_apis_sdk", self.x_bing_apis_sdk, 'str')
Expand All @@ -366,8 +370,8 @@ def search(
header_parameters['X-Search-Location'] = self._serialize.header("location", location, 'str')

# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(request, header_parameters, stream=False, **operation_config)
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
Expand All @@ -386,11 +390,11 @@ def search(

def category(
self, accept_language=None, user_agent=None, client_id=None, client_ip=None, location=None, country_code=None, category=None, count=None, headline_count=None, market=None, offset=None, original_image=None, safe_search=None, set_lang=None, text_decorations=None, text_format=None, custom_headers=None, raw=False, **operation_config):
"""The News Category API lets lets you search on Bing and get back a list
of top news articles by category. This section provides technical
details about the query parameters and headers that you use to request
news and the JSON response objects that contain them. For examples
that show how to make requests, see [Searching the web for
"""The News Category API lets you search on Bing and get back a list of
top news articles by category. This section provides technical details
about the query parameters and headers that you use to request news and
the JSON response objects that contain them. For examples that show
how to make requests, see [Searching the web for
news](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-news-search/search-the-web).

:param accept_language: A comma-delimited list of one or more
Expand Down Expand Up @@ -667,6 +671,10 @@ def category(
"""
# Construct URL
url = self.category.metadata['url']
path_format_arguments = {
'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
Expand Down Expand Up @@ -695,7 +703,7 @@ def category(

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)
header_parameters['X-BingApis-SDK'] = self._serialize.header("self.x_bing_apis_sdk", self.x_bing_apis_sdk, 'str')
Expand All @@ -711,8 +719,8 @@ def category(
header_parameters['X-Search-Location'] = self._serialize.header("location", location, 'str')

# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(request, header_parameters, stream=False, **operation_config)
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
Expand All @@ -731,9 +739,9 @@ def category(

def trending(
self, accept_language=None, user_agent=None, client_id=None, client_ip=None, location=None, country_code=None, count=None, market=None, offset=None, safe_search=None, set_lang=None, since=None, sort_by=None, text_decorations=None, text_format=None, custom_headers=None, raw=False, **operation_config):
"""The News Trending Topics API lets lets you search on Bing and get back
a list of trending news topics that are currently trending on Bing.
This section provides technical details about the query parameters and
"""The News Trending Topics API lets you search on Bing and get back a
list of trending news topics that are currently trending on Bing. This
section provides technical details about the query parameters and
headers that you use to request news and the JSON response objects that
contain them. For examples that show how to make requests, see
[Searching the web for
Expand Down Expand Up @@ -995,6 +1003,10 @@ def trending(
"""
# Construct URL
url = self.trending.metadata['url']
path_format_arguments = {
'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
Expand All @@ -1021,7 +1033,7 @@ def trending(

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)
header_parameters['X-BingApis-SDK'] = self._serialize.header("self.x_bing_apis_sdk", self.x_bing_apis_sdk, 'str')
Expand All @@ -1037,8 +1049,8 @@ def trending(
header_parameters['X-Search-Location'] = self._serialize.header("location", location, 'str')

# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(request, header_parameters, stream=False, **operation_config)
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
# regenerated.
# --------------------------------------------------------------------------

VERSION = "1.0.0"
VERSION = "1.0"

1 change: 1 addition & 0 deletions azure-cognitiveservices-search-newssearch/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
]),
install_requires=[
'msrest>=0.5.0',
'msrestazure>=0.4.32,<2.0.0',
'azure-common~=1.1',
],
extras_require={
Expand Down