Skip to content

Commit

Permalink
Merge pull request #164 from scholarly-python-package/develop
Browse files Browse the repository at this point in the history
Release to master
  • Loading branch information
programize-admin committed Aug 4, 2020
2 parents 1255f66 + 1d20c48 commit affde93
Show file tree
Hide file tree
Showing 10 changed files with 503 additions and 161 deletions.
60 changes: 31 additions & 29 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,45 @@ on:
schedule:
- cron: "0 0 * * *"
push:
branches: [ master, develop ]
branches: [master, develop]
pull_request:
branches: [ master, develop ]
branches: [master, develop]

jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install -y tor
python3 -m pip install --upgrade pip
pip3 install flake8 pytest
if [ -f requirements.txt ]; then pip3 install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
#- name: Typilus, Suggest Python Type Annotations
# uses: typilus/typilus-action@v0.9
- name: Setup Tor to allow for password-based refresh of ID
run: ./setup_tor.sh
- name: Test with unittest
run: |
python3 -m unittest -v test_module.py
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install -y tor
python3 -m pip install --upgrade pip
pip3 install flake8 pytest
if [ -f requirements.txt ]; then pip3 install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
#- name: Typilus, Suggest Python Type Annotations
# uses: typilus/typilus-action@v0.9
- name: Setup Tor to allow for password-based refresh of ID
run: ./setup_tor.sh
- name: Test with unittest
env:
CONNECTION_METHOD: ${{ secrets.CONNECTION_METHOD }}
PASSWORD: ${{ secrets.PASSWORD }}
PORT: ${{ secrets.PORT }}
USERNAME: ${{ secrets.USERNAME }}
run: |
python3 -m unittest -v test_module.py
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ setup_notes.md


#dev testing
vic.py
vic.py
.env
43 changes: 39 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ If necessary to get more information for the publication object, we call the `.f

#### `get_citedby`

Searches GScholar for other articles that cite this Publication and returns a Publication generator.
Searches Google Scholar for other articles that cite this Publication and returns a Publication generator.

#### `bibtex`

Expand All @@ -142,7 +142,7 @@ Here's a quick example:
>>> pub.bibtex
```

by running the code above you should get the following bibtext entry:
by running the code above you should get the following Bibtex entry:

```bib
@inproceedings{ester1996density,
Expand Down Expand Up @@ -278,7 +278,7 @@ This option assumes that you have access to a Tor server and a `torrc` file conf
to have a control port configured with a password; this setup allows scholarly to refresh the Tor ID,
if scholarly runs into problems accessing Google Scholar.

If you want to install and use Tor, then instal it using the command
If you want to install and use Tor, then install it using the command
```
sudo apt-get install -y tor
```
Expand All @@ -300,7 +300,7 @@ print(author)
#### `scholarly.launch_tor()`

If you have Tor installed locally, this option allows scholarly to launch its own Tor process.
You need to pass a pointer to the Tor executable in your syste,
You need to pass a pointer to the Tor executable in your system,

```python
from scholarly import scholarly
Expand All @@ -311,10 +311,45 @@ author = next(scholarly.search_author('Steven A Cholewiak'))
print(author)
```

#### `scholarly.use_lum_proxy()`
If you have a luminaty proxy service, please refer to the environment setup for Luminaty below
and simply call the following command before any function you want to execute.

```python
scholarly.use_lum_proxy()
```
## Setting up environment for Luminaty and/or Testing
To run the `test_module.py` it is advised to create a `.env` file in the working directory of the `test_module.py` as:

```bash
touch .env
```

```bash
nano .env # or any editor of your choice
```

Define the connection method for the Tests, among these options:
- luminaty (if you have a luminaty proxy service)
- freeproxy
- tor
- none (if you want a local connection, which is also the default value)

ex.
```bash
CONNECTION_METHOD = luminaty
```

If using a luminaty proxy service please append the following to your `.env`:

```bash
USERNAME = <LUMINATY_USERNAME>
PASSWORD = <LUMINATY_PASSWORD>
PORT = <PORT_FOR_LUMINATY>
```
## Tests

### Run the tests
To run tests execute the `test_module.py` file as:

```bash
Expand Down
4 changes: 2 additions & 2 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ then retrieve the titles of the papers that cite his most popular
# Which papers cited that publication?
print([citation.bib['title'] for citation in pub.get_citedby()])
# What is the bibtex of that publication?
print(pub.bibtex)
# What is the Bibtex of that publication?
print(pub.bibtex)
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ requests[security]
requests[socks]
stem
fake_useragent
selenium
python-dotenv
free-proxy

0 comments on commit affde93

Please sign in to comment.