Push notification

This is the place for queries that don't fit in any of the other categories.

Push notification

Postby Nuber2Py » Wed Apr 16, 2014 7:57 pm

I am trying to follow the example at this location http://nthn.me/posts/2012/push.html and i did not understand what this line of code does

Code: Select all
fmt = '!cH32sH{0:d}s'.format(len(payload))

If anyone can please help me understand it I would really appreciate that.
Last edited by micseydel on Wed Apr 16, 2014 8:24 pm, edited 1 time in total.
Reason: Code tags, lock.
Posts: 1
Joined: Wed Apr 16, 2014 7:54 pm

Re: Push notification

Postby micseydel » Wed Apr 16, 2014 8:27 pm

It's just creating a format string for the struct.pack() call. The way he knew what the format string is should be documented somewhere by Apple.
Due to the reasons discussed here we will be moving to python-forum.io on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Posts: 3000
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Return to General Coding Help

Who is online

Users browsing this forum: Majestic-12 [Bot] and 5 guests