Skip to content

Commit

Permalink
Update to version 1.0.0 (#49)
Browse files Browse the repository at this point in the history
* Update Python SDK

* Update version to 1.0.0
  • Loading branch information
asriniva authored Mar 30, 2022
1 parent 530a54b commit 9432aae
Show file tree
Hide file tree
Showing 19 changed files with 212 additions and 120 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Google App Engine services SDK for Python 3 (preview)
# Google App Engine services SDK for Python 3

This is a preview release of the App Engine services SDK for Python 3. It provides access
This is a release of the App Engine services SDK for Python 3. It provides access
to various API endpoints that were previously only available on the Python 2.7
runtime.

Expand All @@ -13,7 +13,7 @@ We are working to support more App Engine bundled service APIs for Python 3. To

In your `requirements.txt` file, add the following:

`appengine-python-standard>=0.3.1`
`appengine-python-standard>=1.0.0`

In your app's `app.yaml`, add the following:

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="appengine-python-standard",
version="0.3.1",
version="1.0.0",
author="Google LLC",
description="Google App Engine services SDK for Python 3",
long_description=long_description,
Expand Down
4 changes: 2 additions & 2 deletions src/google/appengine/api/app_identity/app_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@



import os
import time

from google.appengine.api import apiproxy_stub_map
from google.appengine.api import full_app_id
from google.appengine.api.app_identity import _metadata_server
from google.appengine.api.app_identity import app_identity_service_pb2
from google.appengine.runtime import apiproxy_errors
from google.appengine.runtime import context
import six

__all__ = ['BackendDeadlineExceeded',
Expand Down Expand Up @@ -432,7 +432,7 @@ def get_default_version_hostname():



return os.getenv('DEFAULT_VERSION_HOSTNAME')
return context.get('DEFAULT_VERSION_HOSTNAME', None)



Expand Down
4 changes: 2 additions & 2 deletions src/google/appengine/api/datastore_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import binascii
import calendar
import datetime
import os
import re
import struct
import time
Expand All @@ -59,6 +58,7 @@
from google.appengine.datastore import datastore_pbs
from google.appengine.datastore import entity_v4_pb2
from google.appengine.datastore import sortable_pb_encoder
from google.appengine.runtime import context
import six
from six.moves import range
from six.moves import urllib
Expand Down Expand Up @@ -644,7 +644,7 @@ def ToTagUri(self):
return u'tag:%s.%s,%s:%s[%s]' % (

saxutils.escape(EncodeAppIdNamespace(self.app(), self.namespace())),
os.environ['AUTH_DOMAIN'],
context.get('AUTH_DOMAIN'),
datetime.date.today().isoformat(),
saxutils.escape(self.kind()),
saxutils.escape(str(self)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def google_apps_namespace():
if context.READ_FROM_OS_ENVIRON:
return os.environ.get('HTTP_X_APPENGINE_DEFAULT_NAMESPACE')
else:
return context.gae_headers.DEFAULT_NAMESPACE.get()
return context.gae_headers.DEFAULT_NAMESPACE.get(None)


class BadValueError(Exception):
Expand Down
16 changes: 8 additions & 8 deletions src/google/appengine/api/runtime/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
def cpu_usage():
"""Returns a SystemStat describing cpu usage, expressed in mcycles.
The returned object has the following accessors:
The returned object has the following fields:
- total(): total mcycles consumed by this instance
- rate1m(): average mcycles consumed per second over the last minute
- rate10m(): average mcycles consumed per second over the last ten minutes
- total: total mcycles consumed by this instance
- rate1m: average mcycles consumed per second over the last minute
- rate10m: average mcycles consumed per second over the last ten minutes
Functions for converting from mcycles to cpu-seconds are located in the quotas
API.
Expand All @@ -54,11 +54,11 @@ def cpu_usage():
def memory_usage():
"""Returns a SystemStat describing memory usage, expressed in MB.
The returned object has the following accessors:
The returned object has the following fields:
- current(): memory currently used by this instance
- average1m(): average memory use, over the last minute
- average10m(): average memory use, over the last ten minutes
- current: memory currently used by this instance
- average1m: average memory use, over the last minute
- average10m: average memory use, over the last ten minutes
"""
return _GetSystemStats().memory

Expand Down
7 changes: 4 additions & 3 deletions src/google/appengine/api/taskqueue/taskqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from google.appengine.api import urlfetch
from google.appengine.api.taskqueue import taskqueue_service_bytes_pb2 as taskqueue_service_pb2
from google.appengine.runtime import apiproxy_errors
from google.appengine.runtime import context
import six
from six.moves import urllib
import six.moves.urllib.parse
Expand Down Expand Up @@ -933,7 +934,7 @@ def __resolve_hostname_and_target(self):



if 'HTTP_HOST' not in os.environ:
if context.get('HTTP_HOST', None) is None:
logging.warning(
'The HTTP_HOST environment variable was not set, but is required '
'to determine the correct value for the `Task.target\' property. '
Expand All @@ -952,8 +953,8 @@ def __resolve_hostname_and_target(self):
elif 'Host' in self.__headers:
self.__target = self.__target_from_host(self.__headers['Host'])
else:
if 'HTTP_HOST' in os.environ:
self.__headers['Host'] = os.environ['HTTP_HOST']
if context.get('HTTP_HOST', None):
self.__headers['Host'] = context.get('HTTP_HOST')
self.__target = self.__target_from_host(self.__headers['Host'])
else:

Expand Down
Loading

0 comments on commit 9432aae

Please sign in to comment.