Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Cannot submit multiple categories to Categories Statistics endpoint #186

Copy link
Copy link

Description

@chrishenry
Issue body actions

Issue Summary

When using the client to get statistics for categories, it's not possible to submit multiple categories.

Steps to Reproduce

fun_stats = sg.client.categories.stats.get(query_params={
    'start_date': "2016-06-30",
    'categories': ['category1', 'category2'],
})

The above code makes a GET to this URL. Sendgrid returns a 404 for this request.

https://api.sendgrid.com/v3/categories/stats?categories=[u'category1', category2']&start_date=2016-06-30

When the correct behaviour is a GET with both category1 and category1 as values to categories. Sendgrid returns the expected response.

https://api.sendgrid.com/v3/categories/stats?categories=category1&categories=category2&start_date=2016-06-30

This seems to be a bug, as the Sendgrid docs clearly state sending multiple categories is supported, and there doesn't seem to be a way to do that with this client.

I believe the issue is actually here, in the python-http-client lib. urlencode should be passed a second parameter, (doseq), which will correctly format multiple values for parameters. (urlencode docs)

Technical details:

  • sendgrid-python Version: 3.0.0
  • Python Version: 2.7
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.