-
Notifications
You must be signed in to change notification settings - Fork 306
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
Enhance compatibility with Google App Engine #106
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yannmh
changed the title
[WIP] Enhance compatibility with Google App Engine
Enhance compatibility with Google App Engine
Dec 9, 2015
Create a `get_version` util method to resolve `datadog` package version. For compatibility purpose with Google App Engine, handle the case where `pkg_resources` is undefined.
Enhance compatibility with Google App Engine: fall back `simplejson` to stdlib `json`.
Redesign the `api` module to dissociate the API from the HTTP client. Make HTTP clients pluggable. **Changes** Two new modules: * `api_client`. * `APIClient`. Defines * `http_client`. * `HTTPClient`. Defines a pluggable HTTP client skeleton. * `RequestClient`. HTTP client based on `requests` 3p module. One module renamed: * `api.base` module is now `api.resources`
yannmh
force-pushed
the
yann/gae-compatibility
branch
from
April 26, 2016 18:16
ca22208
to
3d73a77
Compare
Create a new HTTP client, `URLFetchClient`, based on `urlfetch` Google App Engine 3p module.
`hostname` is an optional API parameter. Thus, `initialize` method should not raise when unable to resolve it.
yannmh
force-pushed
the
yann/gae-compatibility
branch
from
April 26, 2016 18:24
3d73a77
to
49cf300
Compare
from datadog.util.compat import iteritems | ||
from datadog.util.config import get_version | ||
from datadog.util.hostname import get_hostname |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍰
Following @degemer's feedback: * Make `APIClient` class 100% static * Rewrite the `resolve_http_client` logic in the `HTTPClient` class
👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
get_version
to resolve package versionCreate a
get_version
util method to resolvedatadog
package version.For compatibility purpose with Google App Engine, handle the case where
pkg_resources
is undefined.simplejson
fall back to stdlibjson
Enhance compatibility with Google App Engine: fall back
simplejson
to stdlibjson
.Split API and HTTP clients
Redesign the
api
module to dissociate the API from the HTTP client.Make HTTP clients pluggable.
Changes
Two new modules:
api_client
.APIClient
. Defineshttp_client
.HTTPClient
. Defines a pluggable HTTP client skeleton.RequestClient
. HTTP client based onrequests
3p module.One module renamed:
api.base
module is nowapi.resources
urlfetch
based HTTP clientCreate a new HTTP client,
URLFetchClient
, based onurlfetch
Google App Engine 3p module.Don't raise on hostname resolution failures
hostname
is an optional API parameter. Thus,initialize
method should not raise when unable to resolve it.