一个简单的Instagram Web API库

instpector的Python项目详细描述


仪器

一个用python编写的简单instagram web api库。不需要selenium或webdriver。

支持启用双因素身份验证的登录。

安装

pip install instpector

示例用法

frominstpectorimportInstpector,endpointsinstpector=Instpector()# Login into Instagram's webinstpector.login("my_username","my_password")# Get the profile of any user, for example 'some_username'profile=endpoints.factory.create("profile",instpector)insta_profile=profile.of_user("some_username")print(insta_profile)# id, followers_count, following_count, is_private, ... # Iterate all followers of 'some_username'followers=endpoints.factory.create("followers",instpector)forfollowerinfollowers.of_user(insta_profile.id):print(follower)# id, username, full_name, ...# Logoutinstpector.logout()

使用2fa

要使用双因素身份验证登录,请在Instagram的应用程序上生成2FA密钥,并在使用instpector登录时提供代码。下面的示例使用pytop演示用法:

frompyotpimportTOTPfrominstpectorimportInstpector,endpointsinstpector=Instpector()totp=TOTP("my_2fa_key")# Input without spaces# Login into Instagram's webinstpector.login("my_username","my_password",totp.now())

examples目录中检查更多。

可用端点

  • 追随者
  • 跟随
  • 时间线
  • 配置文件
  • 故事卷
  • 故事

更多信息

开发依赖性

  • 请求

测试

  1. tests目录中创建一个样本内容为pytest.sample.inipytest.ini文件。

  2. 添加您的帐户信息。

  3. 使用pytest

    运行
(env)$ pytest -qs tests

免责声明

本工具不属于Instagram或其任何附属公司或子公司,也不由Instagram或其任何附属公司或子公司授权、维护或背书。使用风险自负。

许可证

根据麻省理工学院的许可证。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为什么我们不能将ArrayList<Integer>传递给具有(Integer…)的方法参数   java Spring RestTemplate映射JSON对映射的响应引发不匹配的PutException   在系统中找到java Selenium元素,但在Jenkins中未找到   java在Android中使用JavaMail API发送电子邮件,而不使用默认/内置应用程序   数组如何在Java数据结构中同时存储数字和相应的单词?   为什么“+”运算符未定义?JAVA   java如何在游戏中添加高分系统?   java在球门碰撞中区分球和球员   java如何使用SpringSecurity4.0.1使用Auth令牌实现Rest完整Web服务。释放   java如何解决这个错误:Android资源链接失败?   java多线程文件处理和数据库批插入   导致Tomcat失败的java无用块线程   java主线程做了太多的工作,尽管我使用了异步线程(laggy UI)   在Java FX 2.0中滚动锚定节点时,锚定始终可见?   java使用EJB3中的客户机jar和设计模式