Coder Social home page Coder Social logo

sameeralmutairi / snapwrap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rob--/snapwrap

0.0 2.0 0.0 756 KB

Wrapper for the unofficial and undocumented Snapchat API (using Snapchat's latest endpoints).

License: MIT License

Python 100.00%

snapwrap's Introduction

SnapWrap

Wrapper for the unofficial and undocumented Snapchat API.


SnapWrap is essentially an API wrapper for Snapchat's API but includes many functions that increase functionality and easability when conversing with Snapchat's API. This library would not be possible without agermanidis or martinp.

SnapWrap's is based directly off agermanidis' library which includes martinp's library (to deal with low level access to the API) - this library includes the newest endpoints of Snapchat's API (loq) and are used when possible.

While finding, inspecting and implementing the newest endpoints I've documented everything I thought necessary. Documentation on the API will expand.

This library does slightly differ to agermanidis' apart from the endpoints. I've added more functions - such as an easier way to save snaps and the ability to mark a snap as replayed.


Installation

python setup.py install

Usage

The following code will simply initiate a class with three "listener" functions that are called appropriately after you call the begin() method. The library is being imported, logging in with the given credentials and then running a constant loop that will check for new updates (snap, friends, etc).

from snapchat import Snapchat

class CustomBot(Snapchat):
	def on_snap(self, sender, snap):
		self.send_snap(snap, sender)
    
	def on_friend_add(self, friend):
		self.add_friend(friend)

	def on_friend_delete(self, friend):
		self.delete_friend(friend)

bot = CustomBot(*["user", "pass"])
bot.begin()

Disclosure

http://rob--.github.io/

Functions

Core Functions

begin(timeout, mark_viewed, mark_screenshotted, mark_replayed) - starts a permanent cycle (with a delay on each iteration) of looking for new snaps and checking for newly added/deleted users. Parameters are optional.

get_snaps(mark_viewed, mark_screenshotted, mark_replayed) - retrieves all new snaps. Parameters are optional.

register(username, password, birthday, email) - registers an account with the corresponding information. Birthdays need to be in the format 'YYYY-MM-DD'.

Snap Functions

send_snap(snap, recipients) - sends a snap. Recipients can either be a string or a list.

save_snap(snap, dir) - saves a snap to a given directory.

post_story(snap) - posts a snap to your story.

delete_story(snap) - deletes a snap from your story.

get_friend_stories() - returns a dict of your friends' usernames and their stories ({'user1' : [storyObj1, storyObj2], "user2": [storyObj1]}).

Friends

get_friends() - returns a list/array of people that you've added.

get_best_friends() - returns a list/array of your best friends.

get_added_me() - returns a list/array of people that have added you.

get_blocked() - returns a list/array of people you've blocked.

add_friend(username) - adds a user to your friends list.

delete_friend(username) - deletes a user from your friends list.

block(username) - blocks a user.

unblock(username) - unblocks a user.

Misc

update_privacy(friends_only) - updates your privacy settings. If friends_only is true, only friends can send you snaps/see your story. If it's false, anyone can.

logout() - logs the account out.

from_file(dir) - upload the snap from a file, e.g. self.from_file("C:\image.jpg").

clear_feed() - clears the snap feed.

clear_conversation(username)- clears a conversation with the given user.

snapwrap's People

Contributors

rob-- avatar ricoxor avatar danwatco avatar

Watchers

James Cloos avatar SaMuTa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.