Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clone - adding option to choose an endpoint prefix. #3

Merged
merged 2 commits into from
Sep 7, 2018

Conversation

neverendingqs
Copy link
Contributor

@neverendingqs neverendingqs commented Sep 6, 2018

Untested.

Tested with build_languages() and data/language/ directory.

E.g.:

diff --git a/data/api/v2/language/3/index.json b/data/api/v2/language/3/index.json
index 4a5e6a20..fbcf381d 100644
--- a/data/api/v2/language/3/index.json
+++ b/data/api/v2/language/3/index.json
@@ -6,29 +6,29 @@
     "names": [
         {
             "language": {
-                "name": "ja",
-                "url": "http://localhost/api/v2/language/1/"
+                "name": "ja-Hrkt",
+                "url": "https://pokeapi.co/api/v2/language/1/"
             },
             "name": "\u97d3\u56fd\u8a9e"
         },
         {
             "language": {
                 "name": "fr",
-                "url": "http://localhost/api/v2/language/5/"
+                "url": "https://pokeapi.co/api/v2/language/5/"
             },
             "name": "Cor\u00e9en"
         },
         {
             "language": {
                 "name": "de",
-                "url": "http://localhost/api/v2/language/6/"
+                "url": "https://pokeapi.co/api/v2/language/6/"
             },
             "name": "Koreanisch"
         },
         {
             "language": {
                 "name": "en",
-                "url": "http://localhost/api/v2/language/9/"
+                "url": "https://pokeapi.co/api/v2/language/9/"
             },
             "name": "Korean"
         }

@neverendingqs
Copy link
Contributor Author

neverendingqs commented Sep 6, 2018

What versions of the libraries are you using? I am getting an error on gevent, and I'm wondering if it's due to versioning of the libraries (I have ran pip3 install -r requirements.txt).

$ ditto clone
Traceback (most recent call last):
  File "/home/neverendingqs/code/pokesource/ditto/env/bin/ditto", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/home/neverendingqs/code/pokesource/ditto/scripts/ditto", line 2, in <module>
    from ditto.main import Ditto
  File "/home/neverendingqs/code/pokesource/ditto/ditto/main.py", line 4, in <module>
    from gevent.wsgi import WSGIServer
ImportError: No module named 'gevent.wsgi'

@neverendingqs
Copy link
Contributor Author

Update: I got it to run with gevent==1.1.0. Currently trying to figure out how to get around the /-escaped characters (e.g. https://pokeapi.co/api/v2/language/ has values like https:\/\/pokeapi.co\/api\/v2\/language\/2\/).

@neverendingqs neverendingqs force-pushed the neverendingqs/endpointprefix branch from 47b6673 to 4b1ae58 Compare September 6, 2018 18:12
@neverendingqs
Copy link
Contributor Author

Updated description with the test I ran.

@sargunv
Copy link
Member

sargunv commented Sep 7, 2018

Looks good, will merge after that one nit is fixed

@sargunv sargunv merged commit fdc87d5 into PokeAPI:master Sep 7, 2018
@@ -13,6 +13,7 @@ def __init__(self):
transform = subparsers.add_parser('clone')
transform.add_argument('--source', type=str, default='http://localhost/')
transform.add_argument('--destination', type=str, default='./data')
transform.add_argument('--replacement-url', type=str, default='https://pokeapi.co/')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm @sargunv does

return re.sub('http://[a-zA-Z0-9.]+/', url, string)
need to be updated as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does need an update to the regex to allow https

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants