Skip to content

Order of operation issue with _unmarshal_json_object #7

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
Jan 6, 2020

Conversation

moilanen
Copy link
Contributor

@moilanen moilanen commented Jan 2, 2020

During an unmarshal the attribute_name was getting set to an empty string. Looks to be an order of operation issue w/ the string append.

@jbonzo
Copy link
Collaborator

jbonzo commented Jan 2, 2020

Hey @moilanen thanks for contributing to this repo. The change you're proposing makes sense but do you mind show an example input as well as a before and after output? We are currently working on fixing our CI system, otherwise a test would be more appropriate.

@moilanen
Copy link
Contributor Author

moilanen commented Jan 3, 2020

Sure thing. I'm on Python 3.7.5 on Mac.

Here's my test and results:

from polygon import RESTClient

def main():
    key = "APIKEY"
    client = RESTClient(key)

    resp = client.stocks_equities_aggregates('AAPL', 20, 'minute', '2019-12-25', '2020-01-02')
    print(str(resp.ticker))

if __name__ == '__main__':
    main()

Before:

$ python test.py
Traceback (most recent call last):
  File "test.py", line 11, in <module>
    main()
  File "test.py", line 7, in main
    print(str(resp.ticker))
AttributeError: 'StocksEquitiesAggregatesApiResponse' object has no attribute 'ticker'

After:

$ python test.py
AAPL

@jbonzo jbonzo merged commit 8d6c93c into polygon-io:master Jan 6, 2020
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

Successfully merging this pull request may close these issues.

2 participants