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

Impressions returned as unicode string, not int #71

Closed
phuston opened this issue Jun 18, 2015 · 9 comments
Closed

Impressions returned as unicode string, not int #71

phuston opened this issue Jun 18, 2015 · 9 comments

Comments

@phuston
Copy link

phuston commented Jun 18, 2015

In the Insights documentation, the stated return type for the Impressions general field is said to be of type Int:

screen shot 2015-06-18 at 2 59 05 pm

When I am making a get_insight call on an AdAccount object, however, the Impressions field is returned as a unicode string. Here's an example call:

account = AdAccount(account_id)

params = {
    'fields': [Insights.Field.impressions,],
    'time_range': {
        'since': '2015-05-15',
        'until': '2015-05-15',
    },
}

stats = account.get_insights(params = params)

print stats

What is returned looks like this, and calling type() on the value for "impressions" returns unicode:

[<Insights> {
    "date_start": "2015-05-15",
    "date_stop": "2015-05-15",
    "impressions": "27155"
}]

Am I missing something here, or are impressions just incorrectly being returned as a unicode string?

@ebzlo
Copy link

ebzlo commented Jun 19, 2015

Hey Patrick!

Looks like this is probably just a documentation error. The correct return type should be a numeric string (or just string). I'll update the docs. Thanks for flagging this!

Evan

@ebzlo ebzlo closed this as completed Jun 19, 2015
@phuston
Copy link
Author

phuston commented Jun 19, 2015

Thanks for getting back to me so quickly - out of curiosity, why would impressions (a numerical statistic) be returned as a string while every other numerical statistic is returned as an integer or a float?

@ebzlo
Copy link

ebzlo commented Jun 19, 2015

We usually return numeric values that can get very large (ids typically) as strings to avoid possible integer overflow issues. It makes it safer to ingest for languages that care about int/bigint. Since this value is typically only used for display (rather than operations), it makes sense to be safe and return a string.

@phuston
Copy link
Author

phuston commented Jun 19, 2015

That does make sense, thank you for clarifying so quickly. I have one last question for you regarding the SDK - what is the status on making asynchronous calls directly from the SDK? I saw it was in development in January, and I'm wondering if it's available yet.

Thank you again,
Patrick

@ebzlo
Copy link

ebzlo commented Jun 19, 2015

Hey @phuston, it's probably the most requested feature for the SDK and we're working on trying to get it released for 2.4

@phuston
Copy link
Author

phuston commented Jun 20, 2015

I understand if you can't divulge this information, but do you have
information on the timeline for its release?

Thanks,

Patrick

On Fri, Jun 19, 2015, 4:49 PM Evan Chen notifications@github.com wrote:

Hey @phuston https://github.com/phuston, it's probably the most
requested feature for the SDK and we're working on trying to get it
released for 2.4


Reply to this email directly or view it on GitHub
#71 (comment)
.

@ebzlo
Copy link

ebzlo commented Jun 20, 2015

I just picked up the task for myself and will try and get it out for you well before then. Feel free to ping me mid next week if you don't see progress. :)

Evan

@phuston
Copy link
Author

phuston commented Jun 20, 2015

Wow! I really appreciate your help in navigating my way through migrating
to the SDK, and I'm looking forward to seeing asynchronous call being
implemented!

Best,
Patrick

On Fri, Jun 19, 2015, 5:27 PM Evan Chen notifications@github.com wrote:

I just picked up the task for myself and will try and get it out for you
well before then. Feel free to ping me mid next week if you don't see
progress. :)

Evan


Reply to this email directly or view it on GitHub
#71 (comment)
.

@phuston
Copy link
Author

phuston commented Jun 23, 2015

@ebzlo, I figured I'd check in again to see how the implementation of the asynchronous calls is coming, and if you have a better feel for an ETA.

-Patrick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants