Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Commit

Permalink
Fixed a few bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Wolff committed Apr 13, 2020
1 parent 05385d2 commit b8a9bde
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 65 deletions.
87 changes: 46 additions & 41 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Using the Spontit API and Spontit app/webapp, you can send your own push notific
1) Sign up at <a href="https://www.spontit.com" target="_blank">spontit.com</a> (you might need to click "Take me to the Desktop version."). Note down your username. It should be displayed in the top left.
2) Get a secret key at <a href="https://www.spontit.com/secret_keys" target="_blank">spontit.com/secret_keys</a>.
3) Get the iPhone app or Android app. Sign in and allow notifications.
4) `pip install spontit`
4) `pip install spontit && pip install requests`
5) `from spontit import SpontitResource`
6) `resource = SpontitResource(my_username, my_secret_key)`
7) `response = resource.push("Hello!")`
Expand Down
10 changes: 5 additions & 5 deletions build/lib/spontit/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ def create_new_channel_and_push_to_it(self):
return self.__resource.push("Hello!",
channel_id=channel_id_to_push_to)
return {
"errors": {
"errors": [{
"message": "Channel not found."
}
}]
}

def create_new_channel_and_get_invite_options(self):
Expand All @@ -200,9 +200,9 @@ def create_new_channel_and_get_invite_options(self):
if channel_id_to_invite_to is not None:
return self.__resource.get_invite_options(channel_id_to_invite_to)
return {
"errors": {
"errors": [{
"message": "Channel not found."
}
}]
}

def get_invite_options_for_my_main_account(self):
Expand All @@ -221,7 +221,7 @@ def get_invite_options_for_my_main_account(self):
print("Simple push example result: " + str(response))

# ...or get right to pushing!
response = spontit_src.push("Hello!")
response = spontit_src.push("Hello!!!")
print("Result: " + str(response))

# To see documentation, run:
Expand Down
8 changes: 4 additions & 4 deletions build/lib/spontit/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ class Expiration:
Use an instance of this class to set the expiration time in the push function.
"""

def __init__(self, days, minutes, hours):
def __init__(self, days, hours, minutes):
# noinspection PyBroadException
try:
assert type(days) == int
assert type(minutes) == int
assert type(hours) == int
assert type(minutes) == int
except Exception:
raise Exception("Days, minutes, and hours must be formatted as an int.")
self.days = days
self.minutes = minutes
self.hours = hours
self.minutes = minutes

def get_time_stamp_from_schedule(self, schedule_time_stamp):
"""
Expand Down Expand Up @@ -154,7 +154,6 @@ def get_display_name_to_channel_id_mapping(self):
:return: The mapping; or an error if there is one
"""
channel_data = self.__post_request(self.__get_payload_dict(), endpoint="get_my_channels")
print(channel_data)
if "data" not in channel_data:
# Error received
return channel_data
Expand Down Expand Up @@ -237,6 +236,7 @@ def push(self,
assert type(ios_deep_link) == str
payload["iOSDeepLink"] = ios_deep_link

payload["userId"] = self.user_id
if channel_id is not None:
assert type(channel_id) == str
payload["userId"] = channel_id
Expand Down
Binary file removed dist/spontit-1.0.1-py3-none-any.whl
Binary file not shown.
Binary file removed dist/spontit-1.0.1.tar.gz
Binary file not shown.
Binary file added dist/spontit-1.0.4-py3-none-any.whl
Binary file not shown.
Binary file added dist/spontit-1.0.4.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="spontit",
version="1.0.1",
version="1.0.4",
author="Spontit Inc",
author_email="[email protected]",
description="Send your own mobile push notifications.",
Expand Down
10 changes: 5 additions & 5 deletions spontit.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: spontit
Version: 1.0.1
Version: 1.0.4
Summary: Send your own mobile push notifications.
Home-page: https://github.com/joshwolff1/spontit_api
Author: Spontit Inc
Expand All @@ -16,11 +16,11 @@ Description: # SPONTIT :vibration_mode:
1) Sign up at <a href="https://www.spontit.com" target="_blank">spontit.com</a> (you might need to click "Take me to the Desktop version."). Note down your username. It should be displayed in the top left.
2) Get a secret key at <a href="https://www.spontit.com/secret_keys" target="_blank">spontit.com/secret_keys</a>.
3) Get the iPhone app or Android app. Sign in and allow notifications.
4) `pip install spontit`
4) `pip install spontit && pip install requests`
5) `from spontit import SpontitResource`
6) `resource = SpontitResource(my_username, my_secret_key)`
7) `response = resource.push("Hello!")`
8) Run the command `help(SpontitResource)` for complete documentation.
8) Run the command `help(SpontitResource)` in Python for complete documentation.
9) Or try an example! Check out the examples at https://github.com/joshwolff1/spontit_api/blob/master/spontit/examples.py
10) You can customize the image of the notification on the website or iPhone app by setting the image for the respective channel. Sub-channel image customization is currently only supported on the iPhone app.
11) To push to others, have them follow the channel to which you will push (e.g. share <a href="https://spontit.com">spontit.com/my_username</a>). You can see available invite options by calling `print(resource.get_invite_options())`.
Expand All @@ -31,7 +31,7 @@ Description: # SPONTIT :vibration_mode:
#### Make an Account

First, go to <a href="https://www.spontit.com" target="_blank">spontit.com</a> or download the <a href="https://itunes.apple.com/us/app/spontit/id1448318683" target="_blank">Spontit app</a>.
Create an account and get your user ID. To see your user ID in the app, tap on the hamburger button. To see your user ID on the website, look at the top of the screen.
Create an account and get your user ID. To see your user ID in the app, tap the "Profile" tab. To see your user ID on the website, look at the top of the screen.

You can change your user ID at any time <a href="https://www.spontit.com/change_names" target="_blank">here</a>.

Expand All @@ -53,7 +53,7 @@ Description: # SPONTIT :vibration_mode:
<img src="https://github.com/joshwolff1/spontit_api/raw/master/images/topic_push.png" />
</p>

Above we see a push notification to a channel (separate from the main channel). Josh owns this channel, but as you can see, it looks like its own account. "Dem 2020 Polls" is the display name, the non-bold text is the call to action, and the image is the image set for the channel. Currently, we only support setting images for sub-channels on the iOS app. To set an image, go to the "Create", select the desired channel, and click the camera icon.
Above we see a push notification to a channel (separate from the main channel). Josh owns this channel, but as you can see, it looks like its own account. "Dem 2020 Polls" is the display name, the non-bold text is the call to action, and the image is the image set for the channel. Currently, we only support setting images for sub-channels on the iOS app. To set an image, go to the "Create" tab, select the desired channel, and click the camera icon.

### Limitations

Expand Down
8 changes: 4 additions & 4 deletions spontit/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ def create_new_channel_and_push_to_it(self):
return self.__resource.push("Hello!",
channel_id=channel_id_to_push_to)
return {
"errors": {
"errors": [{
"message": "Channel not found."
}
}]
}

def create_new_channel_and_get_invite_options(self):
Expand All @@ -200,9 +200,9 @@ def create_new_channel_and_get_invite_options(self):
if channel_id_to_invite_to is not None:
return self.__resource.get_invite_options(channel_id_to_invite_to)
return {
"errors": {
"errors": [{
"message": "Channel not found."
}
}]
}

def get_invite_options_for_my_main_account(self):
Expand Down
7 changes: 3 additions & 4 deletions spontit/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ class Expiration:
Use an instance of this class to set the expiration time in the push function.
"""

def __init__(self, days, minutes, hours):
def __init__(self, days, hours, minutes):
# noinspection PyBroadException
try:
assert type(days) == int
assert type(minutes) == int
assert type(hours) == int
assert type(minutes) == int
except Exception:
raise Exception("Days, minutes, and hours must be formatted as an int.")
self.days = days
self.minutes = minutes
self.hours = hours
self.minutes = minutes

def get_time_stamp_from_schedule(self, schedule_time_stamp):
"""
Expand Down Expand Up @@ -154,7 +154,6 @@ def get_display_name_to_channel_id_mapping(self):
:return: The mapping; or an error if there is one
"""
channel_data = self.__post_request(self.__get_payload_dict(), endpoint="get_my_channels")
print(channel_data)
if "data" not in channel_data:
# Error received
return channel_data
Expand Down

0 comments on commit b8a9bde

Please sign in to comment.