Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add a new_batch_http_request() method to services #105

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

Merged
merged 1 commit into from
Jun 13, 2015
Merged

Conversation

eljobe
Copy link
Contributor

@eljobe eljobe commented Jun 12, 2015

This method can be used to get a BatchHttpRequest object with the
batch_uri calculated from the rootUrl and batchPath fields from the
discovery doc.

Without this change, users have to know what the batch url for newer api
endpoints is. For example:
batch = BatchHttpRequest(batch_uri=http://zoo.googleapis.com/batch)

With this change, the syntax is easier:
zoo = build('zoo', 'v1', http=http)
batch = zoo.new_batch_http_request()

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 12, 2015
# If this is the root Resource, add a new_batch_http_request() method.
if resourceDesc == rootDesc:
def new_batch_http_request(callback=None):
batchPath = 'batch'

This comment was marked as spam.

This comment was marked as spam.

@nathanielmanistaatgoogle
Copy link
Contributor

Spelling errors on both the first and last lines of your commit message, right? Plus an erroneous second space after a period in the middle paragraph (http://www.slate.com/articles/technology/technology/2011/01/space_invaders.html).

def new_batch_http_request(callback=None):
batchPath = 'batch'
if 'batchPath' in rootDesc:
batchPath = rootDesc['batchPath']

This comment was marked as spam.

This comment was marked as spam.

@nathanielmanistaatgoogle
Copy link
Contributor

Given the dynamism here I'll want @craigcitro to be looking at this as well as myself.

@@ -950,6 +951,14 @@ def _set_service_methods(self):
self._add_next_methods(self._resourceDesc, self._schema)

def _add_basic_methods(self, resourceDesc, rootDesc, schema):
# If this is the root Resource, add a new_batch_http_request() method.
batch_uri = '%s%s' % (

This comment was marked as spam.

This comment was marked as spam.

This method can be used to get a BatchHttpRequest object with the
batch_uri calculated from the rootUrl and batchPath fields from the
discovery doc.

Without this change, users have to know what the batch url for newer api
endpoints is. For example:
batch = BatchHttpRequest(batch_uri=http://zoo.googleapis.com/batch)

With this change, the syntax is easier:
zoo = build('zoo', 'v1', http=http)
batch = zoo.new_batch_http_request()
@eljobe eljobe changed the title Add a new_batch_http_request() meethod to services Add a new_batch_http_request() method to services Jun 13, 2015
@eljobe
Copy link
Contributor Author

eljobe commented Jun 13, 2015

Took me a little while to figure out git rebase, but this now looks like a single commit like we wanted, right?

@nathanielmanistaatgoogle
Copy link
Contributor

LGTM. Any urgent need for this to be merged right away?

@craigcitro
Copy link
Contributor

LGTM

nathanielmanistaatgoogle added a commit that referenced this pull request Jun 13, 2015
Add a new_batch_http_request(callback=None) method to services.
@nathanielmanistaatgoogle nathanielmanistaatgoogle merged commit b7f2760 into googleapis:master Jun 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants