{ "info": { "author": "Francisco Rodrigues", "author_email": "francisco.rodrigues0908@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# AO3 API\n\nThis is an unofficial API that let's you access some of AO3's (archiveofourown.org) data through Python.\n\n## Installation\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install AO3 API.\n\n```bash\npip install ao3_api\n```\n\n## Github\n\nhttps://github.com/ArmindoFlores/ao3_api\n\n\n## Usage\n\nThere are 3 types of classes added by the API: ```AO3.Work```, ```AO3.User``` and ```AO3.Session```\n\n\nYou can use the ```AO3.Work``` class to pull data from a work stored in archiveofourown.org\n\n```python\n>>> import AO3\n>>> work = AO3.Work(14392692) # 14392692 is the workid\n>>> work.title\n'The Roots That Clutch'\n>>> work.date_published\ndatetime.date(2018, 4, 22)\n>>> work.authors\n['laquearia']\n>>> work.language\n'English'\n>>> \n```\n\nYou can get the chapter text by calling ```work.load_chapters()``` followed by ```work.get_chapter_text(chapter)```\n\n```python\n>>> import AO3\n>>> work = AO3.Work(14392692)\n>>> work.load_chapters()\n>>> text = work.get_chapter_text(1)\n>>> print(' '.join(text.split(' ')[:20])) # Print the first 20 words\n\nChapter Text\nIt all starts with a suggestion.\u201cHey, we should make this a thing,\u201d Midoriya says one day, out of the\n>>> \n```\n\nIf you don't call ```work.load_chapters()``` you might get this error:\n```python\nTraceback (most recent call last):\n File \"\", line 1, in \n work.get_chapter_text(1)\n File \"C:\\Python36\\lib\\site-packages\\AO3\\works.py\", line 27, in get_chapter_text\n raise utils.UnloadedError(\"Work.load_chapters() must be called first\")\nAO3.utils.UnloadedError: Work.load_chapters() must be called first\n```\n\nYou can use the ```AO3.User``` class to pull data from a user profile:\n\n```python\n>>> import AO3\n>>> user = AO3.User(\"laquearia\")\n>>> user.url\n'https://archiveofourown.org/users/laquearia'\n>>> print(user.bio)\nI have no idea what I'm doing, but I know I'm doing it very, very well. (Artist, 23, in love with tea. Check out my shit.)NOTE: I am known for my angst. Read my things with caution and a box of tissues.\n>>> user.works # Number of works published\n11\n>>>\n```\n\nUse ```user.get_work_list(page)``` to get all the works in a page from the user. If you're not sure how many pages there are, use ```user.npages```\n\n\nIf you have an archiveofourown.org account, you can login with using ```AO3.session(username, password)``` and get a session to access that that's only accessible when you're logged in.\n\n```python\n>>> import AO3\n>>> sess = AO3.session(\"myusername\", \"mypassword\")\n>>> sess.get_n_bookmarks()\n10\n>>> sess.get_bookmarks(page=1) # Get all bookmarks in a page in the format (id, 'work title', ['author1', 'author2'])\n[(123456, 'Work Title', ['author1'])]\n>>> sess.get_subscriptions(page=1) # Get all subscriptions in a page in the format (id, 'work title', ['author1', 'author2'])\n[(123456, 'Work Title', ['author1'])]\n>>>\n```\n\nIf you provide a wrong username / password this error will be raised:\n\n```python\nTraceback (most recent call last):\n File \"\", line 1, in \n s = AO3.Session(\"as\", \"as\")\n File \"C:\\Python36\\lib\\site-packages\\AO3\\session.py\", line 20, in __init__\n raise utils.LoginError(\"Invalid username or password\")\nAO3.utils.LoginError: Invalid username or password\n```\n\n```AO3.utils.workid_from_url(url)``` is a functions that returns the workid given a work url:\n\n```python\n>>> import AO3\n>>> AO3.utils.workid_from_url(\"https://archiveofourown.org/works/14392692/chapters/33236241\")\n14392692\n>>> AO3.utils.workid_from_url(\"https://archiveofourown.org/works/14392692\")\n14392692\n>>> AO3.utils.workid_from_url(\"works/14392692/chapters/33236241\")\n14392692\n>>>\n```\n\n## Future functionalities\n\nIn the future, if no official API is released, I might add a search option and more session options (subscribe to works, kudos and comment).\n\n\n## Contact info\n\nFor information or bug reports please contact francisco.rodrigues0908@gmail.com.\n\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/ArmindoFlores/ao3_api/archive/ao3_api_v_02.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ArmindoFlores/ao3_api", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "ao3-api", "package_url": "https://pypi.org/project/ao3-api/", "platform": "", "project_url": "https://pypi.org/project/ao3-api/", "project_urls": { "Download": "https://github.com/ArmindoFlores/ao3_api/archive/ao3_api_v_02.tar.gz", "Homepage": "https://github.com/ArmindoFlores/ao3_api" }, "release_url": "https://pypi.org/project/ao3-api/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "An unofficial AO3 (archiveofourown.org) API", "version": "0.0.2" }, "last_serial": 5461046, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "7fc511e04699508eab2f2c03f1b122ca", "sha256": "3ec6eadbb2bc33005bad73181bfcd97d9cf1f6f05dd1c6fd8fa92cfa9ec22de6" }, "downloads": -1, "filename": "ao3_api-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "7fc511e04699508eab2f2c03f1b122ca", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6869, "upload_time": "2019-02-11T22:12:21", "url": "https://files.pythonhosted.org/packages/ca/ce/a039a7477eb10afc8ea1df02880fcb5a1d76a0caf7484c94caba2c6cde34/ao3_api-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6458f2075bb91fb0a44f74a408728afa", "sha256": "91addec609db2729183c3fd047a9e5bade4763758ec5d010490dabfd47beb18d" }, "downloads": -1, "filename": "ao3-api-0.0.1.tar.gz", "has_sig": false, "md5_digest": "6458f2075bb91fb0a44f74a408728afa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5629, "upload_time": "2019-02-11T22:12:24", "url": "https://files.pythonhosted.org/packages/99/76/b749d15431d036c1e0a59ec0fd5079e9bc00d6d6a57b4fc21e06b6fc2138/ao3-api-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "072fabdcb1d014bd04b1f848bae76a55", "sha256": "4fa6c195acbebb838e3927550dc203e07c9d4ac0adee736992ca2cd90486e42d" }, "downloads": -1, "filename": "ao3-api-0.0.2.tar.gz", "has_sig": false, "md5_digest": "072fabdcb1d014bd04b1f848bae76a55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5614, "upload_time": "2019-06-28T10:36:12", "url": "https://files.pythonhosted.org/packages/c9/dd/53f31e7faab9f8f55313c0099565361519d1c39bd39cc59c8a17dc5ea58a/ao3-api-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "072fabdcb1d014bd04b1f848bae76a55", "sha256": "4fa6c195acbebb838e3927550dc203e07c9d4ac0adee736992ca2cd90486e42d" }, "downloads": -1, "filename": "ao3-api-0.0.2.tar.gz", "has_sig": false, "md5_digest": "072fabdcb1d014bd04b1f848bae76a55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5614, "upload_time": "2019-06-28T10:36:12", "url": "https://files.pythonhosted.org/packages/c9/dd/53f31e7faab9f8f55313c0099565361519d1c39bd39cc59c8a17dc5ea58a/ao3-api-0.0.2.tar.gz" } ] }