{"action":"closed","number":30,"pull_request":{"url":"https://api.github.com/repos/ZeevG/python-forecast.io/pulls/30","id":33141637,"html_url":"https://github.com/ZeevG/python-forecast.io/pull/30","diff_url":"https://github.com/ZeevG/python-forecast.io/pull/30.diff","patch_url":"https://github.com/ZeevG/python-forecast.io/pull/30.patch","issue_url":"https://api.github.com/repos/ZeevG/python-forecast.io/issues/30","number":30,"state":"closed","locked":false,"title":"Support for naïve datetime objects","user":{"login":"hack-c","id":2947268,"avatar_url":"https://avatars.githubusercontent.com/u/2947268?v=3","gravatar_id":"","url":"https://api.github.com/users/hack-c","html_url":"https://github.com/hack-c","followers_url":"https://api.github.com/users/hack-c/followers","following_url":"https://api.github.com/users/hack-c/following{/other_user}","gists_url":"https://api.github.com/users/hack-c/gists{/gist_id}","starred_url":"https://api.github.com/users/hack-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hack-c/subscriptions","organizations_url":"https://api.github.com/users/hack-c/orgs","repos_url":"https://api.github.com/users/hack-c/repos","events_url":"https://api.github.com/users/hack-c/events{/privacy}","received_events_url":"https://api.github.com/users/hack-c/received_events","type":"User","site_admin":false},"body":"Ref [Issue 21](https://github.com/ZeevG/python-forecast.io/issues/21#issuecomment-92179248). \r\n\r\nThe `.load_forecast()` method is currently converting the datetime argument to seconds since the epoch in *local* time, which has the effect of making it an \"aware\" datetime. That is, it imbues the datetime with statefulness w.r.t. location that it doesn't necessarily have already, if it's passed as a naïve datetime (i.e. \"5 o'clock somewhere\", not necessarily \"5 o'clock in Greenwich.\")\r\n\r\nTechnically, the issue is that `time.mktime()` takes an argument in *local* time (i.e. the locale of my laptop) and converts to seconds since the epoch (docs). In the API though, they expect a naïve datetime, unless timezone is specified. From the API docs:\r\n\r\n*For the latter format, if no timezone is present, local time (at the provided latitude and longitude) is assumed. (This string format is a subset of ISO 8601 time. An as example, `2013-05-06T12:00:00-0400`.)*\r\n\r\nMy thought was, that in order to make the wrapper as thin as possible, that it should behave in the same way. Instead of using `mktime()`, it should use `isoformat()`.\r\n\r\n```\r\nIn [1]: %paste\r\nimport time\r\nimport datetime\r\nfrom delorean import Delorean\r\n\r\n## -- End pasted text --\r\n\r\nIn [2]: d = datetime.datetime(2015, 4, 11, 2, 45)  # initialized without any tzinfo\r\n\r\nIn [3]: d.isoformat()  # this format has no tzinfo, is naïvely unaware of location\r\nOut[3]: '2015-04-11T02:45:00'\r\n\r\nIn [4]: ep = time.mktime(d.timetuple())\r\n\r\nIn [5]: ep  # this number is only associated with datetime(2015, 4, 11, 2, 45) in the sense of GMT-04:00 (I'm in New York.) So it's no longer naïve to location.\r\nOut[5]: 1428734700.0\r\n\r\nIn [6]: dl = Delorean(d, timezone=\"US/Mountain\")  # use delorean to create a timezone-aware datetime.datetime\r\n\r\nIn [7]: dl.datetime  \r\nOut[7]: datetime.datetime(2015, 4, 11, 2, 45, tzinfo=<DstTzInfo 'US/Mountain' MDT-1 day, 18:00:00 DST>)\r\n\r\nIn [8]: dl.datetime.isoformat()  # in this case timezone info would be passed on to the API.\r\nOut[8]: '2015-04-11T02:45:00-06:00'\r\n```","created_at":"2015-04-13T07:44:09Z","updated_at":"2015-06-02T15:00:18Z","closed_at":"2015-06-02T15:00:18Z","merged_at":"2015-06-02T15:00:18Z","merge_commit_sha":"d43a93858f1b67a0f067fa929409ab230f089aef","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ZeevG/python-forecast.io/pulls/30/commits","review_comments_url":"https://api.github.com/repos/ZeevG/python-forecast.io/pulls/30/comments","review_comment_url":"https://api.github.com/repos/ZeevG/python-forecast.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ZeevG/python-forecast.io/issues/30/comments","statuses_url":"https://api.github.com/repos/ZeevG/python-forecast.io/statuses/925680fb174cdc3a8d73b74c1388bfbe3c1d723b","head":{"label":"hack-c:master","ref":"master","sha":"925680fb174cdc3a8d73b74c1388bfbe3c1d723b","user":{"login":"hack-c","id":2947268,"avatar_url":"https://avatars.githubusercontent.com/u/2947268?v=3","gravatar_id":"","url":"https://api.github.com/users/hack-c","html_url":"https://github.com/hack-c","followers_url":"https://api.github.com/users/hack-c/followers","following_url":"https://api.github.com/users/hack-c/following{/other_user}","gists_url":"https://api.github.com/users/hack-c/gists{/gist_id}","starred_url":"https://api.github.com/users/hack-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hack-c/subscriptions","organizations_url":"https://api.github.com/users/hack-c/orgs","repos_url":"https://api.github.com/users/hack-c/repos","events_url":"https://api.github.com/users/hack-c/events{/privacy}","received_events_url":"https://api.github.com/users/hack-c/received_events","type":"User","site_admin":false},"repo":{"id":33846543,"name":"python-forecast.io","full_name":"hack-c/python-forecast.io","owner":{"login":"hack-c","id":2947268,"avatar_url":"https://avatars.githubusercontent.com/u/2947268?v=3","gravatar_id":"","url":"https://api.github.com/users/hack-c","html_url":"https://github.com/hack-c","followers_url":"https://api.github.com/users/hack-c/followers","following_url":"https://api.github.com/users/hack-c/following{/other_user}","gists_url":"https://api.github.com/users/hack-c/gists{/gist_id}","starred_url":"https://api.github.com/users/hack-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hack-c/subscriptions","organizations_url":"https://api.github.com/users/hack-c/orgs","repos_url":"https://api.github.com/users/hack-c/repos","events_url":"https://api.github.com/users/hack-c/events{/privacy}","received_events_url":"https://api.github.com/users/hack-c/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hack-c/python-forecast.io","description":"A thin Python Wrapper for the Forecast.io weather API","fork":true,"url":"https://api.github.com/repos/hack-c/python-forecast.io","forks_url":"https://api.github.com/repos/hack-c/python-forecast.io/forks","keys_url":"https://api.github.com/repos/hack-c/python-forecast.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hack-c/python-forecast.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hack-c/python-forecast.io/teams","hooks_url":"https://api.github.com/repos/hack-c/python-forecast.io/hooks","issue_events_url":"https://api.github.com/repos/hack-c/python-forecast.io/issues/events{/number}","events_url":"https://api.github.com/repos/hack-c/python-forecast.io/events","assignees_url":"https://api.github.com/repos/hack-c/python-forecast.io/assignees{/user}","branches_url":"https://api.github.com/repos/hack-c/python-forecast.io/branches{/branch}","tags_url":"https://api.github.com/repos/hack-c/python-forecast.io/tags","blobs_url":"https://api.github.com/repos/hack-c/python-forecast.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hack-c/python-forecast.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hack-c/python-forecast.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/hack-c/python-forecast.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hack-c/python-forecast.io/statuses/{sha}","languages_url":"https://api.github.com/repos/hack-c/python-forecast.io/languages","stargazers_url":"https://api.github.com/repos/hack-c/python-forecast.io/stargazers","contributors_url":"https://api.github.com/repos/hack-c/python-forecast.io/contributors","subscribers_url":"https://api.github.com/repos/hack-c/python-forecast.io/subscribers","subscription_url":"https://api.github.com/repos/hack-c/python-forecast.io/subscription","commits_url":"https://api.github.com/repos/hack-c/python-forecast.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/hack-c/python-forecast.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/hack-c/python-forecast.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/hack-c/python-forecast.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/hack-c/python-forecast.io/contents/{+path}","compare_url":"https://api.github.com/repos/hack-c/python-forecast.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hack-c/python-forecast.io/merges","archive_url":"https://api.github.com/repos/hack-c/python-forecast.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hack-c/python-forecast.io/downloads","issues_url":"https://api.github.com/repos/hack-c/python-forecast.io/issues{/number}","pulls_url":"https://api.github.com/repos/hack-c/python-forecast.io/pulls{/number}","milestones_url":"https://api.github.com/repos/hack-c/python-forecast.io/milestones{/number}","notifications_url":"https://api.github.com/repos/hack-c/python-forecast.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hack-c/python-forecast.io/labels{/name}","releases_url":"https://api.github.com/repos/hack-c/python-forecast.io/releases{/id}","created_at":"2015-04-13T03:49:16Z","updated_at":"2015-04-13T16:18:15Z","pushed_at":"2015-05-19T07:36:18Z","git_url":"git://github.com/hack-c/python-forecast.io.git","ssh_url":"git@github.com:hack-c/python-forecast.io.git","clone_url":"https://github.com/hack-c/python-forecast.io.git","svn_url":"https://github.com/hack-c/python-forecast.io","homepage":"","size":2123,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ZeevG:master","ref":"master","sha":"e33e466952bfd0cfee1fca1755ada6828e0955dc","user":{"login":"ZeevG","id":3352419,"avatar_url":"https://avatars.githubusercontent.com/u/3352419?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeevG","html_url":"https://github.com/ZeevG","followers_url":"https://api.github.com/users/ZeevG/followers","following_url":"https://api.github.com/users/ZeevG/following{/other_user}","gists_url":"https://api.github.com/users/ZeevG/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeevG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeevG/subscriptions","organizations_url":"https://api.github.com/users/ZeevG/orgs","repos_url":"https://api.github.com/users/ZeevG/repos","events_url":"https://api.github.com/users/ZeevG/events{/privacy}","received_events_url":"https://api.github.com/users/ZeevG/received_events","type":"User","site_admin":false},"repo":{"id":9639049,"name":"python-forecast.io","full_name":"ZeevG/python-forecast.io","owner":{"login":"ZeevG","id":3352419,"avatar_url":"https://avatars.githubusercontent.com/u/3352419?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeevG","html_url":"https://github.com/ZeevG","followers_url":"https://api.github.com/users/ZeevG/followers","following_url":"https://api.github.com/users/ZeevG/following{/other_user}","gists_url":"https://api.github.com/users/ZeevG/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeevG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeevG/subscriptions","organizations_url":"https://api.github.com/users/ZeevG/orgs","repos_url":"https://api.github.com/users/ZeevG/repos","events_url":"https://api.github.com/users/ZeevG/events{/privacy}","received_events_url":"https://api.github.com/users/ZeevG/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ZeevG/python-forecast.io","description":"A thin Python Wrapper for the Forecast.io weather API","fork":false,"url":"https://api.github.com/repos/ZeevG/python-forecast.io","forks_url":"https://api.github.com/repos/ZeevG/python-forecast.io/forks","keys_url":"https://api.github.com/repos/ZeevG/python-forecast.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ZeevG/python-forecast.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ZeevG/python-forecast.io/teams","hooks_url":"https://api.github.com/repos/ZeevG/python-forecast.io/hooks","issue_events_url":"https://api.github.com/repos/ZeevG/python-forecast.io/issues/events{/number}","events_url":"https://api.github.com/repos/ZeevG/python-forecast.io/events","assignees_url":"https://api.github.com/repos/ZeevG/python-forecast.io/assignees{/user}","branches_url":"https://api.github.com/repos/ZeevG/python-forecast.io/branches{/branch}","tags_url":"https://api.github.com/repos/ZeevG/python-forecast.io/tags","blobs_url":"https://api.github.com/repos/ZeevG/python-forecast.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ZeevG/python-forecast.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ZeevG/python-forecast.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/ZeevG/python-forecast.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ZeevG/python-forecast.io/statuses/{sha}","languages_url":"https://api.github.com/repos/ZeevG/python-forecast.io/languages","stargazers_url":"https://api.github.com/repos/ZeevG/python-forecast.io/stargazers","contributors_url":"https://api.github.com/repos/ZeevG/python-forecast.io/contributors","subscribers_url":"https://api.github.com/repos/ZeevG/python-forecast.io/subscribers","subscription_url":"https://api.github.com/repos/ZeevG/python-forecast.io/subscription","commits_url":"https://api.github.com/repos/ZeevG/python-forecast.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/ZeevG/python-forecast.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/ZeevG/python-forecast.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/ZeevG/python-forecast.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/ZeevG/python-forecast.io/contents/{+path}","compare_url":"https://api.github.com/repos/ZeevG/python-forecast.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ZeevG/python-forecast.io/merges","archive_url":"https://api.github.com/repos/ZeevG/python-forecast.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ZeevG/python-forecast.io/downloads","issues_url":"https://api.github.com/repos/ZeevG/python-forecast.io/issues{/number}","pulls_url":"https://api.github.com/repos/ZeevG/python-forecast.io/pulls{/number}","milestones_url":"https://api.github.com/repos/ZeevG/python-forecast.io/milestones{/number}","notifications_url":"https://api.github.com/repos/ZeevG/python-forecast.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ZeevG/python-forecast.io/labels{/name}","releases_url":"https://api.github.com/repos/ZeevG/python-forecast.io/releases{/id}","created_at":"2013-04-24T03:56:59Z","updated_at":"2015-05-29T20:22:48Z","pushed_at":"2015-06-02T15:00:18Z","git_url":"git://github.com/ZeevG/python-forecast.io.git","ssh_url":"git@github.com:ZeevG/python-forecast.io.git","clone_url":"https://github.com/ZeevG/python-forecast.io.git","svn_url":"https://github.com/ZeevG/python-forecast.io","homepage":"","size":2504,"stargazers_count":169,"watchers_count":169,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":45,"mirror_url":null,"open_issues_count":8,"forks":45,"open_issues":8,"watchers":169,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ZeevG/python-forecast.io/pulls/30"},"html":{"href":"https://github.com/ZeevG/python-forecast.io/pull/30"},"issue":{"href":"https://api.github.com/repos/ZeevG/python-forecast.io/issues/30"},"comments":{"href":"https://api.github.com/repos/ZeevG/python-forecast.io/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/ZeevG/python-forecast.io/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/ZeevG/python-forecast.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ZeevG/python-forecast.io/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/ZeevG/python-forecast.io/statuses/925680fb174cdc3a8d73b74c1388bfbe3c1d723b"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"ZeevG","id":3352419,"avatar_url":"https://avatars.githubusercontent.com/u/3352419?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeevG","html_url":"https://github.com/ZeevG","followers_url":"https://api.github.com/users/ZeevG/followers","following_url":"https://api.github.com/users/ZeevG/following{/other_user}","gists_url":"https://api.github.com/users/ZeevG/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeevG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeevG/subscriptions","organizations_url":"https://api.github.com/users/ZeevG/orgs","repos_url":"https://api.github.com/users/ZeevG/repos","events_url":"https://api.github.com/users/ZeevG/events{/privacy}","received_events_url":"https://api.github.com/users/ZeevG/received_events","type":"User","site_admin":false},"comments":11,"review_comments":0,"commits":6,"additions":16,"deletions":10,"changed_files":4}}