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

Fixing typo in demo.py file #611

Merged
merged 3 commits into from
Feb 25, 2022

Conversation

vrutik2809
Copy link
Contributor

Fixes #610

Checklist

  • My branch is up-to-date with upstream/develop branch.
  • Everything works and tested for Python 3.6.0 and above.

Current behaviour

There is a typo in the demo.py file. Due to that the following error was occurring:
image

New expected behaviour

The typo has been removed. Now it will work completely fine.

Change logs

Fixed

  • Typo removed

@Mec-iS
Copy link
Contributor

Mec-iS commented Feb 23, 2022

please check if the same declaration is present in other parts of the codebase

@Mec-iS Mec-iS self-requested a review February 23, 2022 15:20
@vrutik2809
Copy link
Contributor Author

Another two issues found in the same file:

  • No method named insert_classes in doc_parse.py module (line: 60)
  • No method named insert_properties in doc_parse.py module (line: 61)

Need to remove those lines

@vrutik2809 vrutik2809 requested a review from Mec-iS February 23, 2022 17:15
@Mec-iS
Copy link
Contributor

Mec-iS commented Feb 23, 2022

you should provide the changes to fix those then. Are those methods unused or they changed names? Check hydra-python-core repository also.

@Mec-iS
Copy link
Contributor

Mec-iS commented Feb 23, 2022

Those methods have been removed from hydrus/data/doc_parse.py so demo.py should be updated.

@Mec-iS
Copy link
Contributor

Mec-iS commented Feb 23, 2022

@farazkhanfk7 do you know what we use now in place of insert_classes to generate the class objects?

@farazkhanfk7
Copy link
Member

In hydrus/data/db_models.py, there is a Resource class which is used to create a Class or Collection. It has a function make_db_table, which is called by another function create_database_tables to insert classes in the database.

def create_database_tables(classes):
for single_class in classes:
resource = Resource(single_class)
resource.make_db_table()

@vrutik2809
Copy link
Contributor Author

Unavailable method removed from demo.py file

@Mec-iS
Copy link
Contributor

Mec-iS commented Feb 24, 2022

ok. but now the demo should work by using the new methods.

@farazkhanfk7
Copy link
Member

@vrutik2809 you can take a look at app.py for reference and also make sure that hydrus server is working fine after running demo.py.

@vrutik2809
Copy link
Contributor Author

While running demo.py, it is running two times:

  • First, when I run demo.py it's running on http://localhost:8080/api without going in the if block
    image

  • Second when I hit Ctrl + c (in order to stop the server) then it actually goes into the if block and starts running on http://localhost:8080/serverapi but it shows 404 not found
    image

I'm not able to figure out why it is happening.

While debugging it, I also observed that even if pass a different port or api-name it still listen to base-url & api-name provided while making documentation using doc.writer.HydraDoc(). It can be verified in the above image also. Api-name in the doc.py (reference image attached below) is api but in demo.py it is passed as serverapi then it is throwing 404 but when I fire a request on /api then it gives me 200

snap of doc.py :
image

@vrutik2809
Copy link
Contributor Author

I have opened new issue (#613) regarding PORT and API_NAME problem.

@Mec-iS Mec-iS merged commit 474879e into HTTP-APIs:develop Feb 25, 2022
@Mec-iS
Copy link
Contributor

Mec-iS commented Feb 25, 2022

Thanks!

@vrutik2809 vrutik2809 deleted the fix-typo-in-demo.py-file branch February 25, 2022 10:47
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.

Typo in demo.py file
3 participants