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

Commit b8a9bde

Browse files
author
Josh Wolff
committed
Fixed a few bugs
1 parent 05385d2 commit b8a9bde

File tree

12 files changed

+69
-65
lines changed

12 files changed

+69
-65
lines changed

.idea/workspace.xml

Lines changed: 46 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Using the Spontit API and Spontit app/webapp, you can send your own push notific
88
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.
99
2) Get a secret key at <a href="https://www.spontit.com/secret_keys" target="_blank">spontit.com/secret_keys</a>.
1010
3) Get the iPhone app or Android app. Sign in and allow notifications.
11-
4) `pip install spontit`
11+
4) `pip install spontit && pip install requests`
1212
5) `from spontit import SpontitResource`
1313
6) `resource = SpontitResource(my_username, my_secret_key)`
1414
7) `response = resource.push("Hello!")`

build/lib/spontit/examples.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ def create_new_channel_and_push_to_it(self):
176176
return self.__resource.push("Hello!",
177177
channel_id=channel_id_to_push_to)
178178
return {
179-
"errors": {
179+
"errors": [{
180180
"message": "Channel not found."
181-
}
181+
}]
182182
}
183183

184184
def create_new_channel_and_get_invite_options(self):
@@ -200,9 +200,9 @@ def create_new_channel_and_get_invite_options(self):
200200
if channel_id_to_invite_to is not None:
201201
return self.__resource.get_invite_options(channel_id_to_invite_to)
202202
return {
203-
"errors": {
203+
"errors": [{
204204
"message": "Channel not found."
205-
}
205+
}]
206206
}
207207

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

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

227227
# To see documentation, run:

build/lib/spontit/resource.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ class Expiration:
99
Use an instance of this class to set the expiration time in the push function.
1010
"""
1111

12-
def __init__(self, days, minutes, hours):
12+
def __init__(self, days, hours, minutes):
1313
# noinspection PyBroadException
1414
try:
1515
assert type(days) == int
16-
assert type(minutes) == int
1716
assert type(hours) == int
17+
assert type(minutes) == int
1818
except Exception:
1919
raise Exception("Days, minutes, and hours must be formatted as an int.")
2020
self.days = days
21-
self.minutes = minutes
2221
self.hours = hours
22+
self.minutes = minutes
2323

2424
def get_time_stamp_from_schedule(self, schedule_time_stamp):
2525
"""
@@ -154,7 +154,6 @@ def get_display_name_to_channel_id_mapping(self):
154154
:return: The mapping; or an error if there is one
155155
"""
156156
channel_data = self.__post_request(self.__get_payload_dict(), endpoint="get_my_channels")
157-
print(channel_data)
158157
if "data" not in channel_data:
159158
# Error received
160159
return channel_data
@@ -237,6 +236,7 @@ def push(self,
237236
assert type(ios_deep_link) == str
238237
payload["iOSDeepLink"] = ios_deep_link
239238

239+
payload["userId"] = self.user_id
240240
if channel_id is not None:
241241
assert type(channel_id) == str
242242
payload["userId"] = channel_id

dist/spontit-1.0.1-py3-none-any.whl

-11.8 KB
Binary file not shown.

dist/spontit-1.0.1.tar.gz

-9.59 KB
Binary file not shown.

dist/spontit-1.0.4-py3-none-any.whl

11.8 KB
Binary file not shown.

dist/spontit-1.0.4.tar.gz

9.62 KB
Binary file not shown.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setuptools.setup(
99
name="spontit",
10-
version="1.0.1",
10+
version="1.0.4",
1111
author="Spontit Inc",
1212
author_email="[email protected]",
1313
description="Send your own mobile push notifications.",

spontit.egg-info/PKG-INFO

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: spontit
3-
Version: 1.0.1
3+
Version: 1.0.4
44
Summary: Send your own mobile push notifications.
55
Home-page: https://github.com/joshwolff1/spontit_api
66
Author: Spontit Inc
@@ -16,11 +16,11 @@ Description: # SPONTIT :vibration_mode:
1616
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.
1717
2) Get a secret key at <a href="https://www.spontit.com/secret_keys" target="_blank">spontit.com/secret_keys</a>.
1818
3) Get the iPhone app or Android app. Sign in and allow notifications.
19-
4) `pip install spontit`
19+
4) `pip install spontit && pip install requests`
2020
5) `from spontit import SpontitResource`
2121
6) `resource = SpontitResource(my_username, my_secret_key)`
2222
7) `response = resource.push("Hello!")`
23-
8) Run the command `help(SpontitResource)` for complete documentation.
23+
8) Run the command `help(SpontitResource)` in Python for complete documentation.
2424
9) Or try an example! Check out the examples at https://github.com/joshwolff1/spontit_api/blob/master/spontit/examples.py
2525
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.
2626
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())`.
@@ -31,7 +31,7 @@ Description: # SPONTIT :vibration_mode:
3131
#### Make an Account
3232

3333
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>.
34-
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.
34+
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.
3535

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

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

56-
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.
56+
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.
5757

5858
### Limitations
5959

0 commit comments

Comments
 (0)