Repository: IndianOpenSourceFoundation/dynamic-cli
Branch: master
Commit: 4b822b427b5d
Files: 36
Total size: 105.1 KB
Directory structure:
gitextract_zoc4tsr4/
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── documentation.md
│ │ ├── feature.md
│ │ └── proposal.md
│ ├── pull_request_template.md
│ └── workflows/
│ ├── codacy-analysis.yaml
│ ├── codeql-analysis.yml
│ └── greetings.yml
├── .gitignore
├── .travis.yml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── dynamic/
│ ├── __init__.py
│ ├── __main__.py
│ ├── api_test.py
│ ├── error.py
│ ├── markdown.py
│ ├── notion.py
│ ├── save.py
│ ├── search.py
│ ├── settings.py
│ ├── tests/
│ │ ├── __init__.py
│ │ ├── test_get/
│ │ │ ├── __init__.py
│ │ │ ├── output.json
│ │ │ └── test_get_api.py
│ │ ├── test_get_api.py
│ │ └── test_post/
│ │ ├── __init__.py
│ │ ├── input.json
│ │ └── test_post_api.py
│ ├── update.py
│ └── utility.py
├── pyproject.toml
├── requirements.txt
├── setup.py
└── window_setup.md
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/ISSUE_TEMPLATE/documentation.md
================================================
---
name: 📚 Documentation
about: Report an issue related to documentation
labels: "documentation"
---
## 📚 Documentation
(A clear and concise description of what the issue is.)
### Have you read the [Contributing Guidelines on Pull Requests](https://github.com/IndianOpenSourceFoundation/dynamic-cli/blob/master/CONTRIBUTING.md#reporting-new-issues)?
(Write your answer here.)
================================================
FILE: .github/ISSUE_TEMPLATE/feature.md
================================================
---
name: 🚀 Feature
about: Submit a proposal for a new feature
labels: "feature"
---
## 🚀 Feature
(A clear and concise description of what the feature is.)
### Have you read the [Contributing Guidelines on Pull Requests](https://github.com/IndianOpenSourceFoundation/dynamic-cli/blob/master/CONTRIBUTING.md#reporting-new-issues)?
(Write your answer here.)
## Motivation
(Please outline the motivation for the proposal.)
## Pitch
(Please explain why this feature should be implemented and how it would be used.)
================================================
FILE: .github/ISSUE_TEMPLATE/proposal.md
================================================
---
name: 💥 Proposal
about: Propose a non-trivial change to dynamic-cli
labels: "proposal"
---
## 💥 Proposal
(A clear and concise description of what the proposal is.)
### Have you read the [Contributing Guidelines on Pull Requests](https://github.com/IndianOpenSourceFoundation/dynamic-cli/blob/master/CONTRIBUTING.md#reporting-new-issues)?
(Write your answer here.)
================================================
FILE: .github/pull_request_template.md
================================================
## Related Issue
<!--
- Info about Issue or bug
-->
Closes: #[issue number that will be closed through this PR]
## Describe the changes you've made
<!--
A clear and concise description of what you have done to successfully close your assigned issue. Any new files? or anything you feel to let us know!
-->
## Checklist:
<!--
Example how to mark a checkbox:-
- [x] My code follows the code style of this project.
-->
- [ ] My code follows the style guidelines of this project.
- [ ] I have performed a self-review of my own code.
- [ ] I have commented my code, particularly in hard-to-understand areas.
- [ ] I have made corresponding changes to the documentation.
- [ ] My changes generate no new warnings.
## Screenshots
| Original | Updated |
| :---------------------: | :------------------------: |
| **original screenshot** | <b>updated screenshot </b> |
================================================
FILE: .github/workflows/codacy-analysis.yaml
================================================
name: Codacy Security Scan
on:
push:
branches: ["master", "main"]
pull_request:
branches: ["master", "main"]
jobs:
codacy-security-scan:
name: Codacy Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@master
with:
output: results.sarif
format: sarif
# Adjust severity of non-security issues
gh-code-scanning-compat: true
# Force 0 exit code to allow SARIF file generation
# This will handover control about PR rejection to the GitHub side
max-allowed-issues: 2147483647
# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@main
with:
sarif_file: results.sarif
================================================
FILE: .github/workflows/codeql-analysis.yml
================================================
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '37 2 * * 5'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
================================================
FILE: .github/workflows/greetings.yml
================================================
name: Greetings
on: [pull_request_target, issues]
jobs:
greeting:
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Hi👋 thanks for creating your first issue for IOSF, Will get back to you soon !. "
pr-message: "🎉Congratulations!!🎉 for making your first PR , our mentors will review it soon."
================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
temp/*
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
================================================
FILE: .travis.yml
================================================
# Travis-CI Config file
os: linux
dist: focal
language: python
# The test will run on the given python versions
python:
- "3.7"
- "3.8"
- "3.9"
# Installing all the dependencies before testing
install:
- pip3 install -r requirements.txt
# Test command
script:
- py.test-3 -v
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Code of Conduct
## Our Pledge
For the betterment of open-source and in order to make a welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of their age, body size disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, skin tone, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment includes:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants includes:
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed a representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at ping@iosf.in. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
================================================
FILE: CONTRIBUTING.md
================================================
## 🤝First time contributing? We will help you out.👍

Refer to the following articles on the basics of Git and Github and can also contact the Project Mentors, in case you are stuck:
- [Getting started with Git and GitHub](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github)
- [Forking a Repo](https://help.github.com/en/github/getting-started-with-github/fork-a-repo)
- [Cloning a Repo](https://help.github.com/en/desktop/contributing-to-projects/creating-a-pull-request)
- [How to create a Pull Request](https://opensource.com/article/19/7/create-pull-request-github)
***If you don't have git on your machine, [install it](https://help.github.com/articles/set-up-git/).***
## 💥 How to Contribute
[](http://makeapullrequest.com)
[](https://github.com/ellerbrock/open-source-badges/)
- Take a look at the Existing [Issues](https://github.com/IndianOpenSourceFoundation/dynamic-cli.git) or create your own Issues!
- Wait for the Issue to be assigned to you after which you can start working on it.
- Fork the Repo and create a Branch for any Issue that you are working upon.
- Read the [Code of Conduct](https://github.com/IndianOpenSourceFoundation/dynamic-cli.git)
- Create a Pull Request which will be promptly reviewed and suggestions would be added to improve it.
- Add Screenshots to help us know what this Script is all about.
## ⭐ How to make a pull request
**1.** Fork [this](https://github.com/IndianOpenSourceFoundation/dynamic-cli/fork) repository.
Click on the <a href="https://github.com/IndianOpenSourceFoundation/dynamic-cli.git"><img src="https://img.icons8.com/ios/24/000000/code-fork.png"></a> symbol at the top right corner.
**2.** Clone the forked repository.
```bash
git clone https://github.com/<your-github-username>/project_name.git
```
**3.** Navigate to the project directory.
```bash
cd dynamic-cli
```
**4.** Make changes in source code.
**5.** Stage your changes and commit
```bash
#Add changes to Index
git add .
#Commit to the local repo
git commit -m "<your_commit_message>"
```
**7.** Push your local commits to the remote repo.
```bash
git push
```
**8.** Create a [PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request) !
**9.** **Congratulations!** Sit and relax, you've made your contribution to Dynamic-CLI project.
***:trophy: After this, project leaders and mentors will review the changes and will merge your PR if they are found good, otherwise we will suggest the required changes.***
## Style guide for git commit messages
*Here's a list of some good to have points, that can add more value to your contribution logs.*
- Use the present tense (example: "Add feature" and not "Added feature")
- Use the imperative mood (example: "Move item to...", instead of "Moves item to...")
- Limit the first line (also called subject line) to 50 characters or less
- Capitalize the subject line
- Separate subject from body with a blank line
- Do not end the subject line with a period
- Wrap the body at 72 characters
- Use the body to explain what, why, vs, and how
- Reference issues and pull requests liberally after the first line
For more detailed reference to the above points, refer [here](https://chris.beams.io/posts/git-commit.)
## 💥 Issues
For major changes, you are welcomed to open an issue about what you would like to contribute. Enhancements will be appreciated.
### All the Best!🥇
<p align = "center">
<a href="https://github.com/IndianOpenSourceFoundation"> <img src="http://ForTheBadge.com/images/badges/built-by-developers.svg" alt="built by developers"></a>
[](https://github.com/IndianOpenSourceFoundation/dynamic-cli.git)
</p>
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
================================================
FILE: README.md
================================================



[](https://sonarcloud.io/dashboard?id=IndianOpenSourceFoundation_dynamic-cli)
[](https://pepy.tech/project/dynamic-cli)
[](https://pepy.tech/project/dynamic-cli)
[](https://www.gnu.org/licenses/gpl-3.0)
[](https://pypi.python.org/pypi/dynamic-cli/)
<!-- [](https://pypi.org/project/dynamic-cli/) -->
A Modern, user-friendly command-line HTTP client for the API testing, and if you're stuck - Search and browse StackOverflow without leaving the CLI
## Why `Dynamic-cli`?
### The Command Line Utility
Although the Stackoverflow website is really cool, it can be **tough to remember the same question that you faced earlier** :
* Countless answers, you can save it to playbook
* Toggle between multiple answers is easy
* Are you a developer ? Integrate your own feature and install it
## `dynamic-cli` - A Supercharged Command Line Utility
<!--  -->




## Index
* [Installation](#installation)
* [Pip Installation](#pip-installation)
* [Virtual Environment Installation](#virtual-environment-installation)
* [Supported Python Versions](#supported-python-versions)
* [Supported Platforms](#supported-platforms)
* [Windows Support](#windows-support)
* [Developer Installation](#developer-installation)
* [License](#license)
* [Contribution Guidelines](https://github.com/IndianOpenSourceFoundation/dynamic-cli/blob/master/CONTRIBUTING.md)
* [Code Of Conduct](https://github.com/IndianOpenSourceFoundation/dynamic-cli/blob/master/CODE_OF_CONDUCT.md)
* [New to Open Source ?](#contributing)
## Arguments⚙
Usage: Dynamic [OPTIONS] <br>
A Modern, user-friendly command-line HTTP client for the API testing, and if you're stuck - Search and browse StackOverflow without leaving the CLI. <br>
Options: <br>
`-st, --start -> Introduces Dynamic CLI` <br>
`-v, --version -> Gives the Version of the CLI` <br>
`-s, --search -> Search a question on Stackoverflow` <br>
`-no, --notion -> Open browser to login to Notion.so` <br>
`-d, --debug -> Turn on Debugging mode` <br>
`-c, --custom -> Setup a custom API key` <br>
`-p, --playbook -> To access all the answers saved in the playbook` <br>
`-h, --help -> Shows this message and exit` <br>
`-GET -> Make a GET request to an API` <br>
`-POST -> Make a POST request to an API` <br>
`-DELETE -> Make a DELETE request to an API` <br>
## Installation
### Pip Installation
[](http://badge.fury.io/py/dynamic-cli) [](https://pypi.python.org/pypi/dynamic-cli/)
`dynamic-cli` is hosted on [PyPI](https://pypi.python.org/pypi/dynamic-cli). The following command will install `Dynamic-cli`:
pip3 install dynamic-cli
You can also install the latest `dynamic-cli` from GitHub source which can contain changes not yet pushed to PyPI:
pip3 install git+https://github.com/IndianOpenSourceFoundation/dynamic-cli.git
If you are not installing in a `virtualenv`, you might need to run with `sudo`:
sudo pip3 install dynamic-cli
#### `pip3`
Depending on your setup, you might also want to run `pip3` with the [`-H flag`](http://stackoverflow.com/a/28619739):
sudo -H pip3 install dynamic-cli
For most linux users, `pip3` can be installed on your system using the `python3-pip` package.
For example, Ubuntu users can run:
sudo apt-get install python3-pip
### Virtual Environment Installation
You can install Python packages in a [`virtualenv`](http://docs.python-guide.org/en/latest/dev/virtualenvs/) to avoid potential issues with dependencies or permissions.
If you are a Windows user or if you would like more details on `virtualenv`, check out this [guide](http://docs.python-guide.org/en/latest/dev/virtualenvs/).
Install `virtualenv` and `virtualenvwrapper`:
pip3 install virtualenv
pip3 install virtualenvwrapper
export WORKON_HOME=~/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
Create a `dynamic-cli` `virtualenv` and install `dynamic-cli`:
mkvirtualenv dynamic-cli
pip3 install dynamic-cli
If the `pip` install does not work, you might be running Python 2 by default. Check what version of Python you are running:
python --version
If the call above results in Python 2, find the path for Python 3:
which python3 # Python 3 path for mkvirtualenv's --python option
Install Python 3 if needed. Set the Python version when calling `mkvirtualenv`:
mkvirtualenv --python [Python 3 path from above] dynamic-cli
pip3 install dynamic-cli
If you want to activate the `dynamic-cli` `virtualenv` again later, run:
workon dynamic-cli
To deactivate the `dynamic-cli` `virtualenv`, run:
deactivate
### Supported Python Versions
* Python 3.5 - Tested
* Python 3.6 - Tested
* Python 3.7 - Tested
* Python 3.8 - Tested
### Supported Platforms
* Mac OS X
* Tested on OS X 11.16.1
* Linux, Unix
* Tested on Ubuntu 20 LTS
* Windows*
* Tested on Windows 10/11 with WSL only [Currently, you need [WSL](https://docs.microsoft.com/en-us/windows/wsl/install) for this]
### Windows Support
`dynamic-cli` has been tested on Windows 10/11 with [WSL](https://docs.microsoft.com/en-us/windows/wsl/install) installed. Please read the doc [here](https://github.com/IndianOpenSourceFoundation/dynamic-cli/blob/master/window_setup.md)
## Developer Installation📦
**1.** Installing pip
```shell
sudo apt-get install python3-pip
```
**2.** Clone this repository to your local drive
```shell
git clone https://github.com/IndianOpenSourceFoundation/dynamic-cli.git
```
**3.** Go to dynamic directory
```shell
cd dynamic-cli/
```
**4.** Install dependencies
```shell
pip3 install -r requirements.txt
```
**5.** Install with pip
```shell
pip3 install -e .
```
**If you face some issue running dynamic on mac, follow the below instructions**
> **Note for mac users**: Make sure to add these lines in you `~/.bashrc` or `~/.zhsrc`(*depending upon your shell*) 👇
> ```bash
> export LC_ALL=en_US.UTF-8
> export LANG=en_US.UTF-8
> export LC_CTYPE=en_US.UTF-8
> ```
## License
The project is licensed under the GNU General Public License v3. Check out [`LICENSE`](https://github.com/IndianOpenSourceFoundation/dynamic-cli/blob/master/LICENSE)
### Contributing
[](https://github.com/IndianOpenSourceFoundation/dynamic-cli/pulls) [](https://github.com/IndianOpenSourceFoundation/dynamic-cli)
**We're accepting PRs for our open and unassigned [issues](https://github.com/IndianOpenSourceFoundation/dynamic-cli/issues)**. Please check [CONTRIBUTING.md](CONTRIBUTING.md). We'd love your contributions! **Kindly follow the steps below to get started:**
**1.** Fork [this](https://github.com/IndianOpenSourceFoundation/dynamic-cli/fork) repository.
**2.** Clone the forked repository.
```bash
git clone https://github.com/<your-github-username>/project_name.git
```
**3.** Navigate to the project directory.
```bash
cd dynamic-cli
```
**4.** Make changes in source code.
<br />
P.S. If you want to add emojis 😁, use `unicodes`.
Emoji `unicodes` can be found at [https://unicode.org/emoji/charts/full-emoji-list.html](https://unicode.org/emoji/charts/full-emoji-list.html)
<br />
To include an emoji in a string, copy the unicode (Eg: `U+1F600`), replace `+` with `000` and
prefix it with a `\`.
<br />
Eg: `\U0001F604`
**5.** Stage your changes and commit
```bash
# Add changes to Index
git add .
# Commit to the local repo
git commit -m "<your_commit_message>"
```
**7.** Push your local commits to the remote repo.
```bash
git push
```
**8.** Create a [PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request) !
**9.** **Congratulations!** Sit and relax, you've made your contribution to Dynamic-CLI project.
### Testing
We also have written **unit tests for API features** of dynamic-cli, if you have made changes to that section you can run tests as follows:
**1.** To run every test in dynamic-cli:
```bash
pytest
```
**2.** To run test related to only one feature for ex. for GET API Feature:
```bash
pytest -k test_get_api
```
### Dynamic CLI is a part of these open source programs
<p align="center">
<a>
<img width="40%" height="10%" src="https://raw.githubusercontent.com/GirlScriptSummerOfCode/MentorshipProgram/master/GSsoc%20Type%20Logo%20Black.png">
## Contributors👨🏽💻
### Credit goes to these people:✨
<table>
<tr>
<td>
<a href="https://github.com/IndianOpenSourceFoundation/dynamic-cli/graphs/contributors">
<img src="https://contrib.rocks/image?repo=IndianOpenSourceFoundation/dynamic-cli" alt="Dynamic Cli Contributors"/>
</a>
</td>
</tr>
</table>
================================================
FILE: dynamic/__init__.py
================================================
================================================
FILE: dynamic/__main__.py
================================================
#!/usr/bin/env python
import sys
import os
import argparse
root = os.path.dirname(__file__)
sys.path.append(root)
#from dynamic.search import Search
from search import Search
version = "1.1.0"
parser = argparse.ArgumentParser()
parser.add_argument(
"-st", "--start", help="introduce you to dynamic", action="store_true"
)
parser.add_argument(
"-s", "--search", help="search a question on StackOverflow", action="store_true"
)
parser.add_argument(
"-v", "--version", version=f"Dynamic-CLI version {version}", action="version"
)
parser.add_argument(
"-n",
"--new",
help="Opens browser to create new StackOverflow question.",
const=True,
metavar="title (optional)",
nargs="?",
)
parser.add_argument(
"-file", "--file", help="Save answer to a file", action="store_true"
)
parser.add_argument("-c", "--custom", help="Set a custom API key", action="store_true")
parser.add_argument(
"-u", "--update", help="Check updates for the application", action="store_true"
)
parser.add_argument("-GET", help="Make a GET request to an API", action="store_true")
parser.add_argument("-POST", help="Make a POST request to an API", action="store_true")
parser.add_argument(
"-DELETE", help="Make a DELETE request to an API", action="store_true"
)
parser.add_argument(
"-p", "--playbook", help="View and organise the playbook", action="store_true"
)
parser.add_argument(
"-no",
"--notion",
help="\
Login to your Notion account to save playbook.\
Opens a browser window for you to login to\
your Notion accout",
action="store_true",
)
ARGV = parser.parse_args()
search_flag = Search(ARGV)
def main():
if ARGV.start:
print(
"""\U0001F604 Hello and Welcome to Dynamic CLI
\U0001F917 Use the following commands to get started
\U0001F50E Search on StackOverflow with '-s'
\U0001F4C4 Open browser to create new Stack Overflow question with '-n [title(optional)]'
\U0001F4C2 Save answer to a file with '-file'
\U00002728 Know the version of Dynamic CLI with '-v'
\U0001F609 See this message again with '-st'
\U00002755 Get help with '-h'
"""
)
else:
search_flag.search_args()
if __name__ == "__main__":
main()
================================================
FILE: dynamic/api_test.py
================================================
import json
import requests
from pygments import highlight, lexers, formatters
class ApiTesting:
default_url = "https://127.0.0.1:8000"
default_headers = {}
invalid_schema_message = (
"Check whether the URL is valid or check if"
+ "the localhost server is active or not"
)
# fetches the input data for making a request
@classmethod
def fetch_input_url(cls):
request_url = cls.default_url
request_headers = cls.default_headers
input_url = input("Enter URL: ")
input_headers = input("Enter Headers: ")
if input_url != "":
request_url = input_url
if input_headers != "":
try:
request_headers = json.loads(input_headers)
except Exception:
print("Failed to parse Input Headers")
# Check whether the request_url has an endpoint or not
has_endpoint = cls.__check_endpoint(request_url)
# Check if http:// or https:// is present in request_url
has_protocol = cls.__check_protocol(request_url)
if not (has_protocol):
request_url = "https://" + request_url
# Ask the user for endpoint if not present in request_url
if not (has_endpoint):
if request_url[-1] == "/":
endpoint = input("Input endpoint " +
"(Without the starting slash): ")
else:
endpoint = input("Input endpoint (With the starting slash): ")
request_url += endpoint
print("Trying ...\u26A1")
return {
"request_url": request_url,
"request_headers": request_headers,
}
@classmethod
def read_data_from_file(cls):
filename = input("Enter a filename (response_data.json)")
data = {}
if filename.strip() == "":
filename = "response_data.json"
print(f"filename empty, so default file {filename} is used ")
with open(filename, "r") as reader:
file_content = reader.read()
try:
json_data = json.loads(file_content)
data = json_data.get("data")
# Make sure the data is not None and send
except json.JSONDecodeError:
print("Unable to parse the file, Please try again")
cls.read_data_from_file()
return data
@classmethod
def enter_data_payload(cls):
print("Option 1: For sending data payload from terminal\n")
print("Option 2: For sending data payload by reading from json file\n")
store = int(input("Please choose the above options? (1/2)"))
data = {}
if store == 1:
data = input("Enter data as key value pairs")
try:
data = json.loads(data)
except Exception as exception_obj:
print(
f"Unable to load the data due to {exception_obj}, please try again \n"
)
cls.enter_data_payload()
elif store == 2:
data = cls.read_data_from_file()
else:
print(
f"you have entered {store}, please choose from above options")
cls.enter_data_payload()
return data
@classmethod
def fetch_payload_data(cls):
store = input("Do you want to send data payload? (Y/N)")
data = None
if store.lower() == "y":
data = cls.enter_data_payload()
elif store.lower() == "n":
data = {}
else:
print(
f"You have entered {store}, please enter from the above options")
cls.fetch_payload_data()
return data
# saves the json response into a file
@classmethod
def save_response_data(cls, response_data):
store_data = input("Store response data? (Y/N): ")
if store_data.lower() == "y":
filename = input("Enter a filename (response_data.json)")
if filename == "":
filename = "response_data.json"
with open(filename, "w") as jsonFile:
json.dump(response_data, jsonFile, indent=4)
print(f"Response data stored in {filename}")
elif (store_data.lower()) == "n":
print(
f"You have entered {store_data}, So the response is not saved")
else:
print(f"You have entered {store_data}, please enter either Y or N")
cls.save_response_data(response_data)
# formats the response data and prints it in json on console
@classmethod
def print_response_json(cls, response):
print(f"Reponse Status Code: {response.status_code}")
response_data = json.loads(response.content)
parsed_json = json.dumps(response_data, indent=4)
output_json = highlight(
parsed_json, lexers.JsonLexer(), formatters.TerminalFormatter()
)
print(output_json)
# Make GET request
@classmethod
def get_request(cls):
request_data = cls.fetch_input_url()
# Make GET request and store the response in response_data.json
try:
response = requests.get(
request_data["request_url"], headers=request_data["request_headers"]
)
cls.print_response_json(response)
response_data = json.loads(response.content)
cls.save_response_data(response_data)
return response.json()
except requests.exceptions.InvalidSchema:
print(cls.invalid_schema_message)
except Exception as exception_obj:
print(exception_obj)
# Make a POST request
@classmethod
def post_request(cls):
request_data = cls.fetch_input_url()
data = cls.fetch_payload_data()
try:
response = requests.post(
url=request_data["request_url"],
headers=request_data["request_headers"],
data=data,
)
cls.print_response_json(response)
response_data = json.loads(response.content)
cls.save_response_data(response_data)
return response
except requests.exceptions.InvalidSchema:
print(cls.invalid_schema_message)
except Exception as exception_obj:
print(exception_obj)
# Make a delete request
@classmethod
def delete_request(cls):
# request_data contains dictionary of inputs entered by user
request_data = cls.fetch_input_url()
try:
response = requests.delete(
request_data["request_url"], headers=request_data["request_headers"]
)
cls.print_response_json(response)
response_data = json.loads(response.content)
cls.save_response_data(response_data)
except requests.exceptions.InvalidSchema:
print(cls.invalid_schema_message)
except Exception as exception_obj:
print(exception_obj)
@classmethod
def __check_endpoint(cls, request_url):
if request_url == cls.default_url:
return False
else:
return True
@classmethod
def __check_protocol(cls, request_url):
if request_url[:4] == "http":
return True
else:
return False
================================================
FILE: dynamic/error.py
================================================
from termcolor import colored
class SearchError:
def __init__(self, error_statement, suggestion="Try again"):
# the error statement
self.error_statement = error_statement
# the suggestion statement
self.suggestion = suggestion
self.evoke_search_error(self.error_statement)
def evoke_search_error(self, error_statement):
print_text = [
colored(error_statement, "red"),
colored(self.suggestion, "green"),
]
for text_to_print in print_text:
print(text_to_print)
class LoginError:
def __init__(self, error_statement, success=False):
"""
Implements error printing for User Login
:error_statement: Error statement to print
:success: Indicates success of login attempt
Prints in green if True else red
"""
self.error_statement = error_statement
self.success = success
self.evoke_search_error()
def evoke_search_error(self):
color = "green" if self.success else "red"
print_text = colored(self.error_statement, color)
print(print_text)
================================================
FILE: dynamic/markdown.py
================================================
from rich.markdown import Markdown
from rich.console import Console
import html as html
class MarkdownRenderer(object):
def __init__(self, markdown_text, console_print=True):
assert isinstance(markdown_text, str), "Expected a string"
markdown_text = html.unescape(markdown_text)
self.markdown_text = markdown_text
self.do_console_print = bool(console_print)
self.console = Console() # rich console
self.render = self.print_mark_down_text()
def print_mark_down_text(self):
rendered_markdown = Markdown(self.markdown_text)
if self.do_console_print:
self.console.print(rendered_markdown)
return rendered_markdown
def __repr__(self):
return str(self.render)
def __len__(self):
if isinstance(self.render, str):
return len(self.render)
return -1
def __str__(self):
return str(self.render)
================================================
FILE: dynamic/notion.py
================================================
import os
from utility import get_browser_driver
from error import LoginError
from settings import LOGIN_PATH
from settings import TOKEN_FILE_PATH
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
def get_token_from_cookie(cookie, token):
for el in cookie:
if el["name"] == token:
return el
def get_token_from_file():
try:
with open(TOKEN_FILE_PATH, "r") as f:
data = f.read()
except Exception as e:
print(e)
if not data or data == "":
raise RuntimeError("Token not found in file")
else:
return data
def get_cookies_from_login():
"""Capture browser cookies for authentication."""
driver = get_browser_driver()
try:
driver.get(LOGIN_PATH)
WebDriverWait(driver, 300).until(
EC.presence_of_element_located((By.CLASS_NAME, "notion-sidebar-container"))
)
return driver.get_cookies()
except Exception as e:
print(e)
finally:
driver.quit()
class NotionClient:
"""
Implements Login and token retrieval.
Handles the entire procedure of connecting to User's Notion account,
generating Notion's tokenv2_cookie, storing it locally and uploading
content to User's space
"""
def __init__(self):
"""
No input parameters required for instantiating object.
:tokenv2_cookie: stores the cookie containing user's tokenv2
:tokenv2_key: used to create environment variable
"""
self.tokenv2_cookie = None
self.tokenv2_key = "TOKENV2"
def save_token_file(self):
if self.tokenv2_cookie:
with open(TOKEN_FILE_PATH, "w") as f:
f.write(str(self.tokenv2_cookie))
def get_tokenv2_cookie(self):
message_success = "Successfully logged into Notion \U0001F389"
message_failure = "Login unsuccessful. Please try again \U0001F615"
# Sets 'tokenv2_cookie equal to the particular cookie containing token_v2
if not self.tokenv2_cookie:
try:
self.tokenv2_cookie = get_token_from_file()
LoginError(message_success, success=True)
except Exception:
try:
cookies = get_cookies_from_login()
self.tokenv2_cookie = get_token_from_cookie(cookies, "token_v2")
except Exception:
self.tokenv2_cookie = None
finally:
if self.tokenv2_cookie:
os.environ[self.tokenv2_key] = str(self.tokenv2_cookie)
LoginError(message_success, success=True)
self.save_token_file()
else:
LoginError(message_failure, success=False)
return self.get_tokenv2_cookie
================================================
FILE: dynamic/save.py
================================================
import os as os
import json as json
import uuid as uuid
class SaveSearchResults(object):
def __init__(self, result_json):
self.result_json = self.__get_as_dict(result_json[0])
self.save_results_filename = self.generate_file_name(os.getcwd())
self.save_data_to_file(self.result_json, self.save_results_filename)
def save_data_to_file(self, data, filename):
with open(os.path.join(os.getcwd(), f"{filename}.json"), "w") as result_writer:
json.dump(data, result_writer, indent=6)
def __get_as_dict(self, json_array):
result_dict = {}
for index, element in enumerate(json_array):
result_dict[index] = json_array[index]
return dict(result_dict)
def generate_file_name(self, directory):
file_list = os.listdir(directory)
filename = str(uuid.uuid4()).replace("-", "_")[:4]
while filename in file_list:
filename = str(uuid.uuid4()).replace("-", "_")[:4]
return filename
def __repr__(self):
return str(self.save_results_filename)
================================================
FILE: dynamic/search.py
================================================
#!/usr/bin/env python
import webbrowser
from termcolor import colored
import sys as sys
from error import SearchError
from utility import Utility
from utility import Playbook
from save import SaveSearchResults
from update import UpdateApplication
from api_test import ApiTesting
from notion import NotionClient
version = "0.1.0"
class Prompt:
def __init__(self, message):
self.message = message
def prompt(self):
print(colored(f"{self.message} : ", "cyan"), end="")
data = input()
return data
class Search:
def __init__(self, arguments):
self.arguments = arguments
self.utility_object = Utility()
self.api_test_object = ApiTesting()
self.playbook_object = Playbook()
def search_args(self):
if self.arguments.search:
self.search_for_results()
elif self.arguments.file:
self.search_for_results(True)
elif self.arguments.playbook:
self.playbook_object.display_panel()
elif self.arguments.new:
url = "https://stackoverflow.com/questions/ask"
if isinstance(self.arguments.new, str):
webbrowser.open(f"{url}?title={self.arguments.new}")
else:
webbrowser.open(url)
elif self.arguments.custom:
self.utility_object.setCustomKey()
elif self.arguments.update:
update = UpdateApplication(version)
update.check_for_updates()
elif self.arguments.GET:
self.api_test_object.get_request()
elif self.arguments.POST:
self.api_test_object.post_request()
elif self.arguments.DELETE:
self.api_test_object.delete_request()
elif self.arguments.notion:
NotionClient().get_tokenv2_cookie()
def search_for_results(self, save=False):
queries = ["What do you want to search", "Tags (optional)"]
query_solutions = []
# ask question
for each_query in queries:
# Be careful if there are
# KeyBoard Interrupts or EOErrors
try:
prompt = Prompt(str(each_query)).prompt()
if not each_query == "Tags (optional)" and prompt.strip() == "":
SearchError(
"\U0001F613 Input data empty", "\U0001F504 Please try again "
)
sys.exit()
except:
sys.exit()
query_solutions.append(prompt)
question, tags = (
query_solutions[0],
query_solutions[1] if len(query_solutions) > 1 else "",
)
json_output = self.utility_object.make_request(question, tags)
questions = self.utility_object.get_que(json_output)
if questions == []:
# evoke an error
SearchError("\U0001F613 No answer found", "\U0001F604 Please try reddit")
else:
data = self.utility_object.get_ans(questions)
print(
"""
\U0001F604 Hopefully you found what you were looking for!
\U0001F4C2 You can save an answer to a file with '-file'
Not found what you were looking for \U00002754
\U0001F4C4 Open browser and post your question
on StackOverflow with '-n [title (optional)]'
\U0001F50E To search more use '-s'
"""
)
if save:
filename = SaveSearchResults(data)
print(
colored(
f"\U0001F604 Answers successfully saved into {filename}",
"green",
),
)
================================================
FILE: dynamic/settings.py
================================================
import os
from pathlib import Path
NOTION_URL = "https://www.notion.so/"
LOGIN_PATH = NOTION_URL + "/login"
DATA_DIR = os.environ.get(
"DYNAMIC_DATA_DIR", str(Path(os.path.expanduser("~")).joinpath(".dynamic"))
)
PLAYBOOK_FILE = str(Path(DATA_DIR).joinpath("playbook.json"))
TOKEN_FILE_PATH = str(Path(DATA_DIR).joinpath("tokenv2_cookie"))
try:
os.makedirs(DATA_DIR)
except FileExistsError:
pass
if not os.path.isfile(TOKEN_FILE_PATH):
open(TOKEN_FILE_PATH, "w").close()
================================================
FILE: dynamic/tests/__init__.py
================================================
================================================
FILE: dynamic/tests/test_get/__init__.py
================================================
================================================
FILE: dynamic/tests/test_get/output.json
================================================
{
"data": {
"id": 2,
"email": "janet.weaver@reqres.in",
"first_name": "Janet",
"last_name": "Weaver",
"avatar": "https://reqres.in/img/faces/2-image.jpg"
},
"support": {
"url": "https://reqres.in/#support-heading",
"text": "To keep ReqRes free, contributions towards server costs are appreciated!"
}
}
================================================
FILE: dynamic/tests/test_get/test_get_api.py
================================================
from io import StringIO
import json
from dynamic import api_test
class TestApi():
def test_get_request_no_headers(self, monkeypatch):
# Test to check get api response without header
self.test_object = api_test.ApiTesting()
test_uri = "https://reqres.in/api/users/2"
test_headers = ""
save_response = "n"
inputs = StringIO(test_uri+"\n"+test_headers+"\n"+save_response)
monkeypatch.setattr('sys.stdin', inputs)
res = self.test_object.get_request()
file = open(
'dynamic/tests/test_get/output.json')
assert res == json.loads(file.read())
================================================
FILE: dynamic/tests/test_get_api.py
================================================
from io import StringIO
import json
from ..api_test import ApiTesting
class TestApi():
def test_get_request_no_headers(self, monkeypatch):
# Test to check get api response without header
self.test_object = ApiTesting()
test_uri = "https://reqres.in/api/users/2"
test_headers = ""
save_response = "n"
inputs = StringIO(test_uri+"\n"+test_headers+"\n"+save_response)
monkeypatch.setattr('sys.stdin', inputs)
res = self.test_object.get_request()
assert res == json.loads("""{"data":{"id":2,"email":"janet.weaver@reqres.in","first_name":"Janet","last_name":"Weaver","avatar":"https://reqres.in/img/faces/2-image.jpg"},"support":{"url":"https://reqres.in/#support-heading","text":"To keep ReqRes free, contributions towards server costs are appreciated!"}}""")
================================================
FILE: dynamic/tests/test_post/__init__.py
================================================
================================================
FILE: dynamic/tests/test_post/input.json
================================================
{
"name": "morpheus",
"job": "leader"
}
================================================
FILE: dynamic/tests/test_post/test_post_api.py
================================================
from io import StringIO
from dynamic import api_test
import json
class TestApi():
def test_post_request_json_input(self, monkeypatch):
# Test to post response with data using json file
self.test_object = api_test.ApiTesting()
test_uri = "https://reqres.in/api/users"
test_headers = ""
test_store_data = "y"
test_enter_payload_data = "2"
test_data = "dynamic/tests/test_post/input.json"
save_response = "n"
inputs = StringIO(test_uri+"\n"+test_headers+"\n"+test_store_data +
"\n"+test_enter_payload_data+"\n"+test_data+"\n"+save_response)
monkeypatch.setattr('sys.stdin', inputs)
res = self.test_object.post_request()
assert res.status_code == 201
def test_post_request_terminal_input(self, monkeypatch):
# Test to post response with data using terminal
self.test_object = api_test.ApiTesting()
test_uri = "https://reqres.in/api/users"
test_headers = ""
test_store_data = "y"
test_enter_payload_data = "1"
test_data = json.dumps({"name": "aditya", "job": "leader"})
save_response = "n"
inputs = StringIO(test_uri+"\n"+test_headers+"\n"+test_store_data +
"\n"+test_enter_payload_data+"\n"+test_data+"\n"+save_response)
monkeypatch.setattr('sys.stdin', inputs)
res = self.test_object.post_request()
assert res.status_code == 201
================================================
FILE: dynamic/update.py
================================================
import requests as requests
from termcolor import colored
import webbrowser as webbrowser
from error import SearchError
class UpdateApplication(object):
def __init__(self, current_version):
"""
Check for updates in the application
Check for updates in the application
via github's public api. The application
checks for the latest release and makes
sure that the version of the application
is same as the latest release tag
"""
self.current_version = current_version
self.release_api_url = "https://api.github.com/repos/IndianOpenSourceFoundation/dynamic-cli/releases/latest"
def check_for_updates(self):
try:
data = requests.get(self.release_api_url)
data = data.json()
if "message" in data:
if data["message"] == "Not Found":
print(colored("The application does not have any release", "yellow"))
return None
if data["tag_name"] == self.current_version:
print(colored("Yeah! You have the latest version", "green"))
else:
print(colored(f"New release found - {data.tag_name}", "red"))
webbrowser.open(data["html_url"])
except Exception as exception:
exception = SearchError(str(exception), "Try later")
================================================
FILE: dynamic/utility.py
================================================
from termcolor import colored
import requests
from rich.console import Console
from rich.markdown import Markdown
import sys as sys
# Required for Questions Panel
import os
import time
import locale
from collections import defaultdict
from simple_term_menu import TerminalMenu
import webbrowser
from error import SearchError
from save import SaveSearchResults
from markdown import MarkdownRenderer
from settings import PLAYBOOK_FILE
# Required for OAuth
import json
from oauthlib.oauth2 import MobileApplicationClient
from requests_oauthlib import OAuth2Session
# Required for Selenium script and for web_driver_manager
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.firefox import GeckoDriverManager
from webdriver_manager.microsoft import EdgeChromiumDriverManager
console = Console()
def get_browser_driver():
# Try to install web drivers for one of these browsers
# Chrome, Firefox, Edge (One of them must be installed)
try:
return webdriver.Chrome(ChromeDriverManager().install())
except ValueError:
try:
return webdriver.Firefox(executable_path=GeckoDriverManager().install())
except ValueError:
try:
return webdriver.Edge(EdgeChromiumDriverManager().install())
except ValueError:
print(
"You do not have one of these supported browsers:"
+ "Chrome, Firefox, Edge"
)
class Playbook:
def __init__(self):
self.key = "DYNAMIC"
@property
def playbook_path(self):
"""Create an environment variable 'DYNAMIC containing the path of dynamic_playbook.json and returns i."""
if not os.getenv(self.key):
os.environ[self.key] = PLAYBOOK_FILE
return os.getenv(self.key)
@property
def playbook_template(self):
# Basic template and fields of playbook
return {"time_of_update": time.time(), "items_stackoverflow": []}
@property
def playbook_content(self):
# Reads playbook data from local storage and returns it
try:
with open(self.playbook_path, "r") as playbook:
return json.load(playbook)
except FileNotFoundError:
os.makedirs(os.path.dirname(self.playbook_path), exist_ok=True)
with open(self.playbook_path, "w") as playbook:
json.dump(self.playbook_template, playbook, ensure_ascii=False)
return self.playbook_content
@playbook_content.setter
def playbook_content(self, value):
if isinstance(value, dict):
with open(self.playbook_path, "w") as playbook:
json.dump(value, playbook, ensure_ascii=False)
else:
raise ValueError("value should be of type dict")
def is_question_in_playbook(self, question_id):
content = self.playbook_content
for entry in content["items_stackoverflow"]:
if int(entry["question_id"]) == int(question_id):
return True
return False
def add_to_playbook(self, stackoverflow_object, question_id):
"""
Receives a QuestionsPanelStackoverflow object and
saves data of a particular question into playbook
Saves playbook in the following format
{
time_of_update: unix,
items_stackoverflow:
[
{
time: unix timestamp
question_id: 123456,
question_title: 'question_title',
question_link: 'link',
answer_body: 'body of the answer'
},
...
]
"""
if self.is_question_in_playbook(question_id):
console.print(
"[red] Question is already in the playbook," + "No need to add"
)
return
for question in stackoverflow_object.questions_data:
if int(question[1]) == int(question_id):
content = self.playbook_content
now = time.time()
content["time_of_update"] = now
content["items_stackoverflow"].append(
{
"time_of_creation": now,
"question_id": int(question_id),
"question_title": question[0],
"question_link": question[2],
"answer_body": stackoverflow_object.answer_data[
int(question_id)
],
}
)
self.playbook_content = content
console.print("[green] Question added to the playbook")
def delete_from_playbook(self, stackoverflow_object, question_id):
content = self.playbook_content
for i in range(len(content["items_stackoverflow"])):
if content["items_stackoverflow"][i]["question_id"] == question_id:
del content["items_stackoverflow"][i]
break
self.playbook_content = content
self = Playbook()
self.display_panel()
def display_panel(self):
playbook_data = self.playbook_content
if len(playbook_data["items_stackoverflow"]) == 0:
SearchError(
"You have no entries in the playbook",
"Browse and save entries in playbook with 'p' key",
)
sys.exit()
# Creates QuestionPanelStackoverflow object
# populates its question_data and answer_data and displays it
question_panel = QuestionsPanelStackoverflow()
for item in playbook_data["items_stackoverflow"]:
question_panel.questions_data.append(
[item["question_title"], item["question_id"], item["question_link"]]
)
question_panel.answer_data[item["question_id"]] = item["answer_body"]
question_panel.display_panel([], playbook=True)
class QuestionsPanelStackoverflow:
def __init__(self):
# list( list( question_title, question_id, question_link )... )
self.questions_data = []
# dict( question_id:list( body, link ))
# corresponding to self.questions_data
self.answer_data = defaultdict(lambda: False)
self.line_color = "bold red"
self.heading_color = "bold blue"
self.utility = Utility()
self.playbook = Playbook()
def populate_question_data(self, questions_list):
"""
Function to populate question data property
Creates batch request to stackexchange API and to get question
details of questions with id in the list. Stores the returned
data in the following format:
list( list( question_title, question_link, question_id ) )
"""
with console.status("Getting the questions..."):
try:
resp = requests.get(self.utility.get_batch_ques_url(questions_list))
except:
SearchError("Search Failed", "Try connecting to the internet")
sys.exit()
json_ques_data = resp.json()
self.questions_data = [
[item["title"].replace("|", ""), item["question_id"], item["link"]]
for item in json_ques_data["items"]
]
def populate_answer_data(self, questions_list):
"""
Function to populate answer data property
Creates batch request to stackexchange API
to get ans of questions with question id
in the list. Stores the returned data data
in the following format:
dict( question_id:list( body, link ) )
"""
with console.status("Searching answers..."):
try:
resp = requests.get(self.utility.get_batch_ans_url(questions_list))
except:
SearchError("Search Failed", "Try connecting to the internet")
sys.exit()
json_ans_data = resp.json()
for item in json_ans_data["items"]:
if not (self.answer_data[item["question_id"]]):
self.answer_data[item["question_id"]] = item["body_markdown"]
# Sometimes the StackExchange API fails to deliver some answers.
# The below code is to fetch them
failed_ques_id = [
question[1]
for question in self.questions_data
if not (self.answer_data[question[1]])
]
if not (len(failed_ques_id) == 0):
self.populate_answer_data(failed_ques_id)
def return_formatted_ans(self, ques_id):
# This function uses uses Rich Markdown to format answers body.
body_markdown = self.answer_data[int(ques_id)]
body_markdown = str(body_markdown)
xml_markup_replacement = [
("&", "&"),
("<", "<"),
(">", ">"),
(""", '"'),
("'", "'"),
("'", "'"),
]
for convert_from, convert_to in xml_markup_replacement:
body_markdown = body_markdown.replace(convert_from, convert_to)
width = os.get_terminal_size().columns
console = Console(width=width - 4)
markdown = Markdown(body_markdown, hyperlinks=False)
with console.capture() as capture:
console.print(markdown)
highlighted = capture.get()
if not ("UTF" in locale.getlocale()[1]):
box_replacement = [
("─", "-"),
("═", "="),
("║", "|"),
("│", "|"),
("┌", "+"),
("└", "+"),
("┐", "+"),
("┘", "+"),
("╔", "+"),
("╚", "+"),
("╗", "+"),
("╝", "+"),
("•", "*"),
]
for convert_from, convert_to in box_replacement:
highlighted = highlighted.replace(convert_from, convert_to)
return highlighted
def navigate_questions_panel(self, playbook=False):
# Code for navigating through the question panel
if playbook:
message = "Playbook Questions"
instructions = ". Press 'd' to delete from playbook"
keys = ("enter", "d")
else:
message = "Relevant Questions"
instructions = ". Press 'p' to save in playbook"
keys = ("enter", "p")
console.rule("[bold blue] {}".format(message), style="bold red")
console.print(
"[yellow] Use arrow keys to navigate."
+ "'q' or 'Esc' to quit. 'Enter' to open in a browser"
+ instructions
)
console.print()
options = ["|".join(map(str, question)) for question in self.questions_data]
question_menu = TerminalMenu(
options,
preview_command=self.return_formatted_ans,
preview_size=0.75,
accept_keys=keys,
)
quitting = False
while not (quitting):
options_index = question_menu.show()
try:
question_link = self.questions_data[options_index][2]
except Exception:
return sys.exit() if playbook else None
else:
if question_menu.chosen_accept_key == "enter":
webbrowser.open(question_link)
elif question_menu.chosen_accept_key == "p":
self.playbook.add_to_playbook(
self, self.questions_data[options_index][1]
)
elif question_menu.chosen_accept_key == "d" and playbook:
self.playbook.delete_from_playbook(
self, self.questions_data[options_index][1]
)
def display_panel(self, questions_list, playbook=False):
if not playbook:
self.populate_question_data(questions_list)
self.populate_answer_data(questions_list)
self.navigate_questions_panel(playbook=playbook)
class Utility:
def __init__(self):
# the parent url
self.search_content_url = "https://api.stackexchange.com/"
def __get_search_url(self, question, tags):
"""
This function returns the url that contains all the custom
data provided by the user such as tags and question, which
can finally be used to get answers
"""
return f"{self.search_content_url}/2.2/search/advanced?order=desc&sort=relevance&" \
f"tagged={tags}&q={question}&site=stackoverflow"
def get_batch_ques_url(self, ques_id_list):
"""
Returns URL which contains ques_ids which can be use to get
get the details of all the corresponding questions
"""
batch_ques_id = ""
for question_id in ques_id_list:
batch_ques_id += str(question_id) + ";"
return f"{self.search_content_url}/2.2/questions/{batch_ques_id[:-1]}?order=desc&sort=votes&site=stackoverflow&filter=!--1nZwsgqvRX"
def get_batch_ans_url(self, ques_id_list):
batch_ques_id = ""
for question_id in ques_id_list:
batch_ques_id += str(question_id) + ";"
return f"{self.search_content_url}/2.2/questions/{batch_ques_id[:-1]}/answers?order=desc&sort=votes&site=stackoverflow&filter=!--1nZwsgqvRX"
def make_request(self, que, tag: str):
"""
This function uses the requests library to make
the rest api call to the stackexchange server.
:param que: The user questions that servers as
a question in the api.
:type que: String
:param tag: The tags that user wants for searching the relevant
answers. For e.g. TypeError might be for multiple
languages so is tag is used as "Python" then the
api will return answers based on the tags and question.
:type tag: String
:return: Json response from the api call.
:rtype: Json format data
"""
with console.status("Searching..."):
try:
url = self.__get_search_url(que, tag)
resp = requests.get(url)
except:
SearchError(
"\U0001F613 Search Failed",
"\U0001F4BB Try connecting to the internet",
)
sys.exit()
return resp.json()
def get_que(self, json_data):
"""
This function returns the list of ids of the questions
that have been answered, from the response that we get
from the make_request function.
"""
que_id = []
for data in json_data["items"]:
if data["answer_count"]:
que_id.append(data["question_id"])
return que_id
def get_ans(self, questions_list):
"""
This Function creates QuestionsPanel_stackoverflow class which supports
Rendering, navigation, searching and redirecting capabilities
"""
stackoverflow_panel = QuestionsPanelStackoverflow()
stackoverflow_panel.display_panel(questions_list)
# Support for reddit searching can also be implemented from here
# Get an access token and extract to a JSON file "access_token.json"
@classmethod
def setCustomKey(self):
"""
scopes possible values:
read_inbox - access a user's global inbox
no_expiry - access_token's with this scope do not expire
write_access - perform write operations as a user
private_info - access full history of a user's private
actions on the site
"""
client_id = 20013
scopes = "read_inbox"
authorization_url = "https://stackoverflow.com/oauth/dialog"
redirect_uri = "https://stackexchange.com/oauth/login_success"
# Create an OAuth session and open the auth_url in a browser
# for the user to authenticate
stackApps = OAuth2Session(
client=MobileApplicationClient(client_id=client_id),
scope=scopes,
redirect_uri=redirect_uri,
)
auth_url, state = stackApps.authorization_url(authorization_url)
driver = get_browser_driver()
# Open auth_url in one of the supported browsers
driver.get(auth_url)
# Close the window after 20s
# (Assuming that the user logs in within 30 seconds)
time.sleep(30)
# Close the windows as soon as authorization is done
try:
WebDriverWait(driver, 1).until(
EC.presence_of_element_located((By.TAG_NAME, "h2"))
)
callback_url = driver.current_url
finally:
driver.quit()
# Extract access token data from callback_url
accessTokenData = stackApps.token_from_fragment(callback_url)
# Store the access token data in a dictionary
jsonDict = {
"access_token": accessTokenData["access_token"],
"expires": accessTokenData["expires"],
"state": state,
}
with open("access_token.json", "w") as jsonFile:
json.dump(jsonDict, jsonFile)
================================================
FILE: pyproject.toml
================================================
[build-system]
requires = [
"setuptools>=42",
"wheel",
"certifi==2020.6.20",
"chardet==3.0.4",
"idna==2.10",
"requests==2.24.0",
"termcolor==1.1.0",
"urllib3==1.25.10",
"rich==9.9.0",
"oauthlib==3.1.0",
"requests-oauthlib==1.3.0",
"colorama==0.4.4",
"configparser==5.0.2",
"crayons==0.4.0",
"selenium==3.141.0",
"webdriver-manager==3.3.0",
"simple-term-menu==1.0.1"
]
build-backend = "setuptools.build_meta"
================================================
FILE: requirements.txt
================================================
certifi==2020.6.20
chardet==3.0.4
idna==2.10
requests==2.24.0
termcolor==1.1.0
urllib3==1.25.10
rich==9.9.0
oauthlib==3.1.0
requests-oauthlib==1.3.0
colorama==0.4.4
configparser==5.0.2
crayons==0.4.0
selenium==3.141.0
webdriver-manager==3.3.0
simple-term-menu==1.0.1
pytest==7.1.1
================================================
FILE: setup.py
================================================
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
DEPENDENCIES = [
"certifi==2020.6.20",
"chardet==3.0.4",
"idna==2.10",
"requests==2.24.0",
"termcolor==1.1.0",
"urllib3==1.25.10",
"rich==9.9.0",
"oauthlib==3.1.0",
"requests-oauthlib==1.3.0",
"colorama==0.4.4",
"configparser==5.0.2",
"crayons==0.4.0",
"selenium==3.141.0",
"webdriver-manager==3.3.0",
"simple-term-menu==1.0.1",
]
setuptools.setup(
name="dynamic-cli",
version="1.1",
author="IOSF Community",
author_email="ping@iosf.in",
description="A Modern, user-friendly command-line HTTP client for the API testing, and if you're stuck - Search and browse StackOverflow without leaving the CLI",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/IndianOpenSourceFoundation/dynamic-cli",
project_urls={
"Bug Tracker": "https://github.com/IndianOpenSourceFoundation/dynamic-cli/issues",
},
install_requires=DEPENDENCIES,
package_dir={},
packages=setuptools.find_packages(),
entry_points={"console_scripts": ["dynamic=dynamic.__main__:main"]},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires=">=3.6",
zip_safe=False,
)
================================================
FILE: window_setup.md
================================================
How to Setup WSL for Windows -
- Install the Linux distribution from the Microsoft Store. Click on Window icon > Microsoft Store > Search for Ubuntu

- You can now install everything you need to run Windows Subsystem for Linux (WSL) by entering this command in an administrator PowerShell or Windows Command Prompt and then restarting your machine.
```
wsl --install
```
NOTE: You need to run the PowerShell as Run as Administrator mode.
```
Click on Window button > Search for Window powershell > Right Click > Run as Administrator
```
After installing, You'll see a ubuntu icons in your windows. Please find the below screenshot for the references -


gitextract_zoc4tsr4/ ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── documentation.md │ │ ├── feature.md │ │ └── proposal.md │ ├── pull_request_template.md │ └── workflows/ │ ├── codacy-analysis.yaml │ ├── codeql-analysis.yml │ └── greetings.yml ├── .gitignore ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── dynamic/ │ ├── __init__.py │ ├── __main__.py │ ├── api_test.py │ ├── error.py │ ├── markdown.py │ ├── notion.py │ ├── save.py │ ├── search.py │ ├── settings.py │ ├── tests/ │ │ ├── __init__.py │ │ ├── test_get/ │ │ │ ├── __init__.py │ │ │ ├── output.json │ │ │ └── test_get_api.py │ │ ├── test_get_api.py │ │ └── test_post/ │ │ ├── __init__.py │ │ ├── input.json │ │ └── test_post_api.py │ ├── update.py │ └── utility.py ├── pyproject.toml ├── requirements.txt ├── setup.py └── window_setup.md
SYMBOL INDEX (82 symbols across 12 files)
FILE: dynamic/__main__.py
function main (line 75) | def main():
FILE: dynamic/api_test.py
class ApiTesting (line 6) | class ApiTesting:
method fetch_input_url (line 16) | def fetch_input_url(cls):
method read_data_from_file (line 53) | def read_data_from_file(cls):
method enter_data_payload (line 71) | def enter_data_payload(cls):
method fetch_payload_data (line 95) | def fetch_payload_data(cls):
method save_response_data (line 111) | def save_response_data(cls, response_data):
method print_response_json (line 129) | def print_response_json(cls, response):
method get_request (line 140) | def get_request(cls):
method post_request (line 158) | def post_request(cls):
method delete_request (line 180) | def delete_request(cls):
method __check_endpoint (line 197) | def __check_endpoint(cls, request_url):
method __check_protocol (line 204) | def __check_protocol(cls, request_url):
FILE: dynamic/error.py
class SearchError (line 4) | class SearchError:
method __init__ (line 5) | def __init__(self, error_statement, suggestion="Try again"):
method evoke_search_error (line 14) | def evoke_search_error(self, error_statement):
class LoginError (line 23) | class LoginError:
method __init__ (line 24) | def __init__(self, error_statement, success=False):
method evoke_search_error (line 35) | def evoke_search_error(self):
FILE: dynamic/markdown.py
class MarkdownRenderer (line 6) | class MarkdownRenderer(object):
method __init__ (line 7) | def __init__(self, markdown_text, console_print=True):
method print_mark_down_text (line 18) | def print_mark_down_text(self):
method __repr__ (line 26) | def __repr__(self):
method __len__ (line 29) | def __len__(self):
method __str__ (line 34) | def __str__(self):
FILE: dynamic/notion.py
function get_token_from_cookie (line 13) | def get_token_from_cookie(cookie, token):
function get_token_from_file (line 19) | def get_token_from_file():
function get_cookies_from_login (line 31) | def get_cookies_from_login():
class NotionClient (line 46) | class NotionClient:
method __init__ (line 56) | def __init__(self):
method save_token_file (line 66) | def save_token_file(self):
method get_tokenv2_cookie (line 71) | def get_tokenv2_cookie(self):
FILE: dynamic/save.py
class SaveSearchResults (line 6) | class SaveSearchResults(object):
method __init__ (line 7) | def __init__(self, result_json):
method save_data_to_file (line 13) | def save_data_to_file(self, data, filename):
method __get_as_dict (line 17) | def __get_as_dict(self, json_array):
method generate_file_name (line 23) | def generate_file_name(self, directory):
method __repr__ (line 31) | def __repr__(self):
FILE: dynamic/search.py
class Prompt (line 17) | class Prompt:
method __init__ (line 18) | def __init__(self, message):
method prompt (line 21) | def prompt(self):
class Search (line 27) | class Search:
method __init__ (line 28) | def __init__(self, arguments):
method search_args (line 34) | def search_args(self):
method search_for_results (line 61) | def search_for_results(self, save=False):
FILE: dynamic/tests/test_get/test_get_api.py
class TestApi (line 6) | class TestApi():
method test_get_request_no_headers (line 7) | def test_get_request_no_headers(self, monkeypatch):
FILE: dynamic/tests/test_get_api.py
class TestApi (line 6) | class TestApi():
method test_get_request_no_headers (line 8) | def test_get_request_no_headers(self, monkeypatch):
FILE: dynamic/tests/test_post/test_post_api.py
class TestApi (line 6) | class TestApi():
method test_post_request_json_input (line 7) | def test_post_request_json_input(self, monkeypatch):
method test_post_request_terminal_input (line 27) | def test_post_request_terminal_input(self, monkeypatch):
FILE: dynamic/update.py
class UpdateApplication (line 8) | class UpdateApplication(object):
method __init__ (line 9) | def __init__(self, current_version):
method check_for_updates (line 24) | def check_for_updates(self):
FILE: dynamic/utility.py
function get_browser_driver (line 39) | def get_browser_driver():
class Playbook (line 57) | class Playbook:
method __init__ (line 58) | def __init__(self):
method playbook_path (line 62) | def playbook_path(self):
method playbook_template (line 69) | def playbook_template(self):
method playbook_content (line 74) | def playbook_content(self):
method playbook_content (line 86) | def playbook_content(self, value):
method is_question_in_playbook (line 93) | def is_question_in_playbook(self, question_id):
method add_to_playbook (line 100) | def add_to_playbook(self, stackoverflow_object, question_id):
method delete_from_playbook (line 143) | def delete_from_playbook(self, stackoverflow_object, question_id):
method display_panel (line 153) | def display_panel(self):
class QuestionsPanelStackoverflow (line 172) | class QuestionsPanelStackoverflow:
method __init__ (line 173) | def __init__(self):
method populate_question_data (line 186) | def populate_question_data(self, questions_list):
method populate_answer_data (line 206) | def populate_answer_data(self, questions_list):
method return_formatted_ans (line 235) | def return_formatted_ans(self, ques_id):
method navigate_questions_panel (line 275) | def navigate_questions_panel(self, playbook=False):
method display_panel (line 318) | def display_panel(self, questions_list, playbook=False):
class Utility (line 325) | class Utility:
method __init__ (line 326) | def __init__(self):
method __get_search_url (line 330) | def __get_search_url(self, question, tags):
method get_batch_ques_url (line 339) | def get_batch_ques_url(self, ques_id_list):
method get_batch_ans_url (line 349) | def get_batch_ans_url(self, ques_id_list):
method make_request (line 355) | def make_request(self, que, tag: str):
method get_que (line 382) | def get_que(self, json_data):
method get_ans (line 394) | def get_ans(self, questions_list):
method setCustomKey (line 405) | def setCustomKey(self):
Condensed preview — 36 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (114K chars).
[
{
"path": ".github/ISSUE_TEMPLATE/documentation.md",
"chars": 381,
"preview": "---\nname: 📚 Documentation\nabout: Report an issue related to documentation\nlabels: \"documentation\"\n---\n\n## 📚 Documentatio"
},
{
"path": ".github/ISSUE_TEMPLATE/feature.md",
"chars": 519,
"preview": "---\nname: 🚀 Feature\nabout: Submit a proposal for a new feature\nlabels: \"feature\"\n---\n\n## 🚀 Feature\n\n(A clear and concise"
},
{
"path": ".github/ISSUE_TEMPLATE/proposal.md",
"chars": 372,
"preview": "---\nname: 💥 Proposal\nabout: Propose a non-trivial change to dynamic-cli\nlabels: \"proposal\"\n---\n\n## 💥 Proposal\n\n(A clear "
},
{
"path": ".github/pull_request_template.md",
"chars": 904,
"preview": "## Related Issue\n<!--\n- Info about Issue or bug\n-->\n\nCloses: #[issue number that will be closed through this PR]\n\n\n## De"
},
{
"path": ".github/workflows/codacy-analysis.yaml",
"chars": 927,
"preview": "name: Codacy Security Scan\n\non:\n push:\n branches: [\"master\", \"main\"]\n pull_request:\n branches: [\"master\", \"main\""
},
{
"path": ".github/workflows/codeql-analysis.yml",
"chars": 2349,
"preview": "# For most projects, this workflow file will not need changing; you simply need\n# to commit it to your repository.\n#\n# Y"
},
{
"path": ".github/workflows/greetings.yml",
"chars": 427,
"preview": "name: Greetings\n\non: [pull_request_target, issues]\n\njobs:\n greeting:\n runs-on: ubuntu-latest\n steps:\n - uses"
},
{
"path": ".gitignore",
"chars": 2770,
"preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packagi"
},
{
"path": ".travis.yml",
"chars": 292,
"preview": "# Travis-CI Config file\nos: linux\n\ndist: focal\n\nlanguage: python\n\n# The test will run on the given python versions\npytho"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 3022,
"preview": "# Contributor Code of Conduct\n\n## Our Pledge\n\nFor the betterment of open-source and in order to make a welcoming environ"
},
{
"path": "CONTRIBUTING.md",
"chars": 4096,
"preview": "\n## 🤝First time contributing? We will help you out.👍\n\n 2007 Free "
},
{
"path": "README.md",
"chars": 10495,
"preview": "\nsys.path.append(root)\n#fr"
},
{
"path": "dynamic/api_test.py",
"chars": 7401,
"preview": "import json\nimport requests\nfrom pygments import highlight, lexers, formatters\n\n\nclass ApiTesting:\n default_url = \"ht"
},
{
"path": "dynamic/error.py",
"chars": 1196,
"preview": "from termcolor import colored\r\n\r\n\r\nclass SearchError:\r\n def __init__(self, error_statement, suggestion=\"Try again\"):\r"
},
{
"path": "dynamic/markdown.py",
"chars": 978,
"preview": "from rich.markdown import Markdown\r\nfrom rich.console import Console\r\nimport html as html\r\n\r\n\r\nclass MarkdownRenderer(ob"
},
{
"path": "dynamic/notion.py",
"chars": 2953,
"preview": "import os\n\nfrom utility import get_browser_driver\nfrom error import LoginError\nfrom settings import LOGIN_PATH\nfrom sett"
},
{
"path": "dynamic/save.py",
"chars": 1113,
"preview": "import os as os\r\nimport json as json\r\nimport uuid as uuid\r\n\r\n\r\nclass SaveSearchResults(object):\r\n def __init__(self, "
},
{
"path": "dynamic/search.py",
"chars": 3733,
"preview": "#!/usr/bin/env python\nimport webbrowser\nfrom termcolor import colored\nimport sys as sys\n\nfrom error import SearchError\nf"
},
{
"path": "dynamic/settings.py",
"chars": 490,
"preview": "import os\nfrom pathlib import Path\n\nNOTION_URL = \"https://www.notion.so/\"\nLOGIN_PATH = NOTION_URL + \"/login\"\nDATA_DIR = "
},
{
"path": "dynamic/tests/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "dynamic/tests/test_get/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "dynamic/tests/test_get/output.json",
"chars": 373,
"preview": "{\n \"data\": {\n \"id\": 2,\n \"email\": \"janet.weaver@reqres.in\",\n \"first_name\": \"Janet\",\n \"last"
},
{
"path": "dynamic/tests/test_get/test_get_api.py",
"chars": 636,
"preview": "from io import StringIO\nimport json\nfrom dynamic import api_test\n\n\nclass TestApi():\n def test_get_request_no_headers("
},
{
"path": "dynamic/tests/test_get_api.py",
"chars": 841,
"preview": "from io import StringIO\nimport json\nfrom ..api_test import ApiTesting\n\n\nclass TestApi():\n\n def test_get_request_no_he"
},
{
"path": "dynamic/tests/test_post/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "dynamic/tests/test_post/input.json",
"chars": 47,
"preview": "{\n \"name\": \"morpheus\",\n \"job\": \"leader\"\n}"
},
{
"path": "dynamic/tests/test_post/test_post_api.py",
"chars": 1491,
"preview": "from io import StringIO\nfrom dynamic import api_test\nimport json\n\n\nclass TestApi():\n def test_post_request_json_input"
},
{
"path": "dynamic/update.py",
"chars": 1431,
"preview": "import requests as requests\r\nfrom termcolor import colored\r\nimport webbrowser as webbrowser\r\n\r\nfrom error import SearchE"
},
{
"path": "dynamic/utility.py",
"chars": 17543,
"preview": "from termcolor import colored\nimport requests\nfrom rich.console import Console\nfrom rich.markdown import Markdown\nimport"
},
{
"path": "pyproject.toml",
"chars": 475,
"preview": "[build-system]\nrequires = [\n \"setuptools>=42\",\n \"wheel\",\n \"certifi==2020.6.20\",\n \"chardet==3.0.4\",\n \"idna"
},
{
"path": "requirements.txt",
"chars": 280,
"preview": "certifi==2020.6.20\nchardet==3.0.4\nidna==2.10\nrequests==2.24.0\ntermcolor==1.1.0\nurllib3==1.25.10\nrich==9.9.0\noauthlib==3."
},
{
"path": "setup.py",
"chars": 1452,
"preview": "import setuptools\n\nwith open(\"README.md\", \"r\", encoding=\"utf-8\") as fh:\n long_description = fh.read()\n\nDEPENDENCIES ="
},
{
"path": "window_setup.md",
"chars": 1023,
"preview": "How to Setup WSL for Windows - \n\n- Install the Linux distribution from the Microsoft Store. Click on Window icon > Micro"
}
]
About this extraction
This page contains the full source code of the IndianOpenSourceFoundation/dynamic-cli GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 36 files (105.1 KB), approximately 24.8k tokens, and a symbol index with 82 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.