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

Commit

Permalink
Merge pull request #8 from levi-rs/update-readme
Browse files Browse the repository at this point in the history
Update README and minor css path tweak
  • Loading branch information
levi-rs committed Apr 17, 2017
2 parents 91062ae + 1a0ec03 commit 9290f77
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 4 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
CHANGES
=======

0.0.3
-----

* Fix README formatting

0.0.2
-----

* Add page validation functionality
* Update Instagram and add landing and base pages
* Remove Waffle badge
* Update PyPI password hash
Expand Down
90 changes: 90 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,93 @@ Note that is project is currently in alpha: APIs can and will change without war
.. |Gitter| image:: https://badges.gitter.im/levi-rs/instabrade.svg
:alt: Join the chat at https://gitter.im/levi-rs/instabrade
:target: https://gitter.im/levi-rs/instabrade?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge


Currently support functionality:

- Log into Instagram


Planned functionality in upcoming release(s):

- Handle the mobile app center screen modal popup
- Handle the mobile app footer modal popup
- Return all posts from Home page


Example usage:

.. code-block:: python
from selenium import webdriver
from instabrde import Instagram
my_username = "my username"
my_password = "my password"
driver = webdriver.Chrome()
try:
# Instantiate the object
# - This also loads instagram's URL
ig = Instagram(driver)
# Click the "Log in" link to display the login fields
ig.log_in_page.log_in_link_click()
# Fill in the username and password fields
ig.log_in_page.log_in_username = my_username
ig.log_in_page.log_in_password = my_password
# Click the Log In button
ig.log_in_page.log_in_button_click()
finally:
driver.quit()
Instabrade is page-aware. If you attempt to interact with a property or method
for a page that isn't currently loaded, a WrongPageError exception will get
thrown:

.. code-block:: shell
In [1]: from selenium import webdriver
In [2]: from instabrade import Instagram
In [3]: driver = webdriver.Chrome()
In [4]: ig = Instagram(driver)
In [5]: ig.log_in_page.log_in_link_click()
In [6]: ig.log_in_page.log_in_username = my_username
In [7]: ig.log_in_page.log_in_password = my_password
In [8]: ig.log_in_page.log_in_button_click()
In [9]: ig.log_in_page.log_in_username = my_username
---------------------------------------------------------------------------
WrongPageError Traceback (most recent call last)
<ipython-input-9-eb1e96eabcf5> in <module>()
----> 1 ig.log_in_page.log_in_username = my_username
/Users/levi/workspace/instabrade/instabrade/decorators.py in inner(obj, *args, **kwargs)
7 @wraps(func)
8 def inner(obj, *args, **kwargs):
----> 9 obj.assert_on_page()
10
11 return func(obj, *args, **kwargs)
/Users/levi/workspace/instabrade/instabrade/base.py in assert_on_page(self)
64 exc_msg = "Wrong page loaded. Expected {0} but found {1}"
65 raise WrongPageError(exc_msg.format(self.PAGE_IDENTIFIER,
---> 66 current_page_identifier))
67
68 @property
WrongPageError: Wrong page loaded. Expected PageID(name='Log In Page Identifier', css_path='h1.coreSpriteLoggedOutWordmark', attr='class', attr_value='coreSpriteLoggedOutWordmark') but found PageID(name='Home Page Identifier', css_path='main[role="main"] > section a[href$="explore/"]', attr='href', attr_value='/explore/')
In [10]:
5 changes: 1 addition & 4 deletions instabrade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
HOME_IDENTIFIER = PageID(name='Home Page Identifier',
css_path='main[role="main"] > section a[href$="explore/"]',
attr='href',
attr_value='https://www.instagram.com/explore/')



attr_value='/explore/')

from instabrade.instagram import Instagram # noqa

0 comments on commit 9290f77

Please sign in to comment.